Issue42

Title add a global option to start running commands from repo root
Priority feature Status resolved
Superseder Nosy List mpm, tksoh, tonfa
Assigned To Topics

Created on 2005-10-27.04:32:11 by tksoh, last changed 2005-12-15.17:29:12 by ThomasAH.

Messages
msg302 (view) Author: ThomasAH Date: 2005-12-15.17:29:10
Works fine
msg226 (view) Author: tonfa Date: 2005-11-21.17:20:11
patch refreshed to tip follows:

# HG changeset patch
# User Benoit Boissinot <benoit.boissinot@ens-lyon.org>
# Node ID ee6ed2c0142156ef6942d5417e02fbb46aa9e298
# Parent  68ec7b9e09a48d8100cf5394279060cefdda1f82
make all commands be repo-wide by default

- refactor code in commands.py so that:
  if no pattern is given, the command will be repo-wide
  else it will work on the working dir
- update the doc
- fix the tests

diff -r 68ec7b9e09a4 -r ee6ed2c01421 mercurial/commands.py
--- a/mercurial/commands.py	Thu Nov 17 19:38:57 2005 +0100
+++ b/mercurial/commands.py	Mon Nov 21 18:16:24 2005 +0100
@@ -33,13 +33,17 @@
         return [util.normpath(os.path.join(cwd, x)) for x in args]
     return args

-def matchpats(repo, cwd, pats=[], opts={}, head=''):
+def matchpats(repo, pats=[], opts={}, head=''):
+    cwd = repo.getcwd()
+    if not pats and cwd:
+        opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
+        opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
+        cwd = ''
     return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'),
-                        opts.get('exclude'), head)
+                        opts.get('exclude'), head) + (cwd,)

 def makewalk(repo, pats, opts, head=''):
-    cwd = repo.getcwd()
-    files, matchfn, anypats = matchpats(repo, cwd, pats, opts, head)
+    files, matchfn, anypats, cwd = matchpats(repo, pats, opts, head)
     exact = dict(zip(files, files))
     def walk():
         for src, fn in repo.walk(files=files, match=matchfn):
@@ -51,7 +55,7 @@
     for r in results:
         yield r

-def walkchangerevs(ui, repo, cwd, pats, opts):
+def walkchangerevs(ui, repo, pats, opts):
     '''Iterate over files and the revs they changed in.

     Callers most commonly need to iterate backwards over the history
@@ -81,12 +85,7 @@
     if repo.changelog.count() == 0:
         return [], False

-    cwd = repo.getcwd()
-    if not pats and cwd:
-        opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
-        opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
-    files, matchfn, anypats = matchpats(repo, (pats and cwd) or '',
-                                        pats, opts)
+    files, matchfn, anypats, cwd = matchpats(repo, pats, opts)
     revs = map(int, revrange(ui, repo, opts['rev'] or ['tip:0']))
     wanted = {}
     slowpath = anypats
@@ -483,8 +482,7 @@

     The files will be added to the repository at the next commit.

-    If no names are given, add all files in the current directory and
-    its subdirectories.
+    If no names are given, add all files in the repository.
     """

     names = []
@@ -759,7 +757,7 @@
     Commit changes to the given files into the repository.

     If a list of files is omitted, all changes reported by "hg status"
-    from the root of the repository will be commited.
+    will be commited.

     The HGEDITOR or EDITOR environment variables are used to start an
     editor to add a commit comment.
@@ -782,12 +780,7 @@

     if opts['addremove']:
         addremove(ui, repo, *pats, **opts)
-    cwd = repo.getcwd()
-    if not pats and cwd:
-        opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
-        opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
-    fns, match, anypats = matchpats(repo, (pats and repo.getcwd()) or '',
-                                    pats, opts)
+    fns, match, anypats, cwd = matchpats(repo, pats, opts)
     if pats:
         c, a, d, u = repo.changes(files=fns, match=match)
         files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r']
@@ -1041,7 +1034,7 @@
         ui.write("%s\n" % line.rstrip())

 def diff(ui, repo, *pats, **opts):
-    """diff working directory (or selected files)
+    """diff repository (or selected files)

     Show differences between revisions for the specified files.

@@ -1067,7 +1060,7 @@
     if len(revs) > 2:
         raise util.Abort(_("too many revisions to diff"))

-    fns, matchfn, anypats = matchpats(repo, repo.getcwd(), pats, opts)
+    fns, matchfn, anypats, cwd = matchpats(repo, pats, opts)

     dodiff(sys.stdout, ui, repo, node1, node2, fns, match=matchfn,
            text=opts['text'])
@@ -1238,7 +1231,7 @@

     fstate = {}
     skip = {}
-    changeiter, getchange = walkchangerevs(ui, repo, repo.getcwd(), pats, opts)
+    changeiter, getchange = walkchangerevs(ui, repo, pats, opts)
     count = 0
     incrementing = False
     for st, rev, fns in changeiter:
@@ -1501,12 +1494,7 @@
                 self.write(*args)
         def __getattr__(self, key):
             return getattr(self.ui, key)
-    cwd = repo.getcwd()
-    if not pats and cwd:
-        opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
-        opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
-    changeiter, getchange = walkchangerevs(ui, repo, (pats and cwd) or '',
-                                           pats, opts)
+    changeiter, getchange = walkchangerevs(ui, repo, pats, opts)
     for st, rev, fns in changeiter:
         if st == 'window':
             du = dui(ui)
@@ -1815,13 +1803,12 @@

     If names are given, all files matching the names are reverted.

-    If no names are given, all files in the current directory and
-    its subdirectories are reverted.
+    If no arguments are given, all files in the repository are reverted.
     """
     node = opts['rev'] and repo.lookup(opts['rev']) or \
            repo.dirstate.parents()[0]

-    files, choose, anypats = matchpats(repo, repo.getcwd(), pats, opts)
+    files, choose, anypats, cwd = matchpats(repo, pats, opts)
     (c, a, d, u) = repo.changes(match=choose)
     repo.forget(a)
     repo.undelete(d)
@@ -1944,9 +1931,8 @@
 def status(ui, repo, *pats, **opts):
     """show changed files in the working directory

-    Show changed files in the working directory.  If no names are
-    given, all files are shown.  Otherwise, only files matching the
-    given names are shown.
+    Show changed files in the repository.  If names are
+    given, only files that match are shown.

     The codes used to show the status of files are:
     M = modified
@@ -1955,8 +1941,7 @@
     ? = not tracked
     """

-    cwd = repo.getcwd()
-    files, matchfn, anypats = matchpats(repo, cwd, pats, opts)
+    files, matchfn, anypats, cwd = matchpats(repo, pats, opts)
     (c, a, d, u) = [[util.pathto(cwd, x) for x in n]
                     for n in repo.changes(files=files, match=matchfn)]

diff -r 68ec7b9e09a4 -r ee6ed2c01421 tests/test-help.out
--- a/tests/test-help.out	Thu Nov 17 19:38:57 2005 +0100
+++ b/tests/test-help.out	Mon Nov 21 18:16:24 2005 +0100
@@ -6,23 +6,23 @@
  annotate   show changeset information per file line
  clone      make a copy of an existing repository
  commit     commit the specified files or all outstanding changes
- diff       diff working directory (or selected files)
- export     dump the header and diffs for one or more changesets
- init       create a new repository in the given directory
- log        show revision history of entire repository or files
- parents    show the parents of the working dir or revision
- pull       pull changes from the specified source
- push       push changes to the specified destination
- remove     remove the specified files on the next commit
- revert     revert modified files or dirs back to their unmodified states
- serve      export the repository via HTTP
- status     show changed files in the working directory
- update     update or merge working directory
- add        add the specified files on the next commit
- annotate   show changeset information per file line
- clone      make a copy of an existing repository
- commit     commit the specified files or all outstanding changes
- diff       diff working directory (or selected files)
+ diff       diff repository (or selected files)
+ export     dump the header and diffs for one or more changesets
+ init       create a new repository in the given directory
+ log        show revision history of entire repository or files
+ parents    show the parents of the working dir or revision
+ pull       pull changes from the specified source
+ push       push changes to the specified destination
+ remove     remove the specified files on the next commit
+ revert     revert modified files or dirs back to their unmodified states
+ serve      export the repository via HTTP
+ status     show changed files in the working directory
+ update     update or merge working directory
+ add        add the specified files on the next commit
+ annotate   show changeset information per file line
+ clone      make a copy of an existing repository
+ commit     commit the specified files or all outstanding changes
+ diff       diff repository (or selected files)
  export     dump the header and diffs for one or more changesets
  init       create a new repository in the given directory
  log        show revision history of entire repository or files
@@ -46,7 +46,7 @@
  clone       make a copy of an existing repository
  commit      commit the specified files or all outstanding changes
  copy        mark files as copied for the next commit
- diff        diff working directory (or selected files)
+ diff        diff repository (or selected files)
  export      dump the header and diffs for one or more changesets
  forget      don't add the specified files on the next commit
  grep        search for a pattern in specified files and revisions
@@ -88,7 +88,7 @@
  clone       make a copy of an existing repository
  commit      commit the specified files or all outstanding changes
  copy        mark files as copied for the next commit
- diff        diff working directory (or selected files)
+ diff        diff repository (or selected files)
  export      dump the header and diffs for one or more changesets
  forget      don't add the specified files on the next commit
  grep        search for a pattern in specified files and revisions
@@ -130,8 +130,7 @@

     The files will be added to the repository at the next commit.

-    If no names are given, add all files in the current directory and
-    its subdirectories.
+    If no names are given, add all files in the repository.

 options:

@@ -146,8 +145,7 @@

     The files will be added to the repository at the next commit.

-    If no names are given, add all files in the current directory and
-    its subdirectories.
+    If no names are given, add all files in the repository.

 options:

@@ -155,7 +153,7 @@
  -X --exclude  exclude names matching the given patterns
 hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...

-diff working directory (or selected files)
+diff repository (or selected files)

     Show differences between revisions for the specified files.

@@ -181,9 +179,8 @@

 show changed files in the working directory

-    Show changed files in the working directory.  If no names are
-    given, all files are shown.  Otherwise, only files matching the
-    given names are shown.
+    Show changed files in the repository.  If names are
+    given, only files that match are shown.

     The codes used to show the status of files are:
     M = modified
@@ -215,7 +212,7 @@
  annotate   show changeset information per file line
  clone      make a copy of an existing repository
  commit     commit the specified files or all outstanding changes
- diff       diff working directory (or selected files)
+ diff       diff repository (or selected files)
  export     dump the header and diffs for one or more changesets
  init       create a new repository in the given directory
  log        show revision history of entire repository or files
@@ -236,15 +233,15 @@
  annotate   show changeset information per file line
  clone      make a copy of an existing repository
  commit     commit the specified files or all outstanding changes
- diff       diff working directory (or selected files)
- export     dump the header and diffs for one or more changesets
- init       create a new repository in the given directory
- log        show revision history of entire repository or files
- parents    show the parents of the working dir or revision
- pull       pull changes from the specified source
- push       push changes to the specified destination
- remove     remove the specified files on the next commit
- revert     revert modified files or dirs back to their unmodified states
- serve      export the repository via HTTP
- status     show changed files in the working directory
- update     update or merge working directory
+ diff       diff repository (or selected files)
+ export     dump the header and diffs for one or more changesets
+ init       create a new repository in the given directory
+ log        show revision history of entire repository or files
+ parents    show the parents of the working dir or revision
+ pull       pull changes from the specified source
+ push       push changes to the specified destination
+ remove     remove the specified files on the next commit
+ revert     revert modified files or dirs back to their unmodified states
+ serve      export the repository via HTTP
+ status     show changed files in the working directory
+ update     update or merge working directory
diff -r 68ec7b9e09a4 -r ee6ed2c01421 tests/test-hgignore
--- a/tests/test-hgignore	Thu Nov 17 19:38:57 2005 +0100
+++ b/tests/test-hgignore	Mon Nov 21 18:16:24 2005 +0100
@@ -42,4 +42,4 @@
 echo "--" ; hg status

 cd dir
-echo "--" ; hg status
+echo "--" ; hg status .
diff -r 68ec7b9e09a4 -r ee6ed2c01421 tests/test-walk
--- a/tests/test-walk	Thu Nov 17 19:38:57 2005 +0100
+++ b/tests/test-walk	Mon Nov 21 18:16:24 2005 +0100
@@ -20,14 +20,14 @@
 hg commit -m "commit #0" -d "0 0"
 hg debugwalk
 cd mammals
-hg debugwalk
+hg debugwalk .
 hg debugwalk Procyonidae
 cd Procyonidae
-hg debugwalk
+hg debugwalk .
 hg debugwalk ..
 cd ..
 hg debugwalk ../beans
-hg debugwalk
+hg debugwalk .
 cd ..
 hg debugwalk -Ibeans
 hg debugwalk 'glob:mammals/../beans/b*'
msg102 (view) Author: tonfa Date: 2005-10-30.09:30:23
Doing hg status before revert will give the same result (if you don't
use revert -r).

regards,

Benoit
msg101 (view) Author: xiaofeng.ling Date: 2005-10-30.07:31:15
Support, I like this behavior.
so commit, status, diff are consistent.
I'd also like to talk about "hg revert", 
I feels it is too dangerous if having the same behaviour.
current behavious is not consistent and also not safe.
So how about for "hg revert", it just show the files that will be reverted
in the whole repository and "hg revert -f" to do the real revert.
If files are specified in the command line, then "-f" can be omitted.
msg100 (view) Author: jsgf Date: 2005-10-29.21:34:36
Matt Mackall wrote:

Fine with me.  It would make scripting much easier if there were a
consistent universal behaviour.

    J
msg98 (view) Author: mpm Date: 2005-10-29.21:03:54
Of the mail on this topic, I think Jeremy's has addressed most of the
interesting points. So here are my further thoughts:

Ok, I like this point. The '.' approach is arguably the cleanest and
most flexible. People who don't like waiting for 'hg status' to stat
their whole tree can quickly learn to use '.'.

I tend to think commit is right too, mostly because tree-wide atomic
commits are central to what a 'changeset' is: grouping -all- relevant
file-level changes together. The system thus encourages checking in a
complete change. Making the rest of the system consistent with commit
is a decent argument.

Actually, it's exactly the sort of user preference which causes things
to break unexpectedly. And thus it's best avoided. I'd rather have hg
bite everyone one more time by making the change while we're pre-1.0
than have people get repeatedly bit by a config option going forward.

Also a good argument. Mercurial fundamentally sees everything at a
tree-wide level. Emulating the weaknesses of CVS' recursive repository
scheme doesn't buy us much.

So, if anyone has strong objections to:

hg status -> tree-wide
hg status . -> current directory and below (current hg status)
hg diff -> tree-wide
hg diff . -> current directory and below (current hg status)

..now's a good time to speak up.

In addition to Benoit's patch, we'll probably need to add a test case
and then double-check all the docs.
msg86 (view) Author: jsgf Date: 2005-10-27.21:21:27
Matt Mackall wrote:

I've come to the conclusion that it was a mistake.  When I type 'hg
status' or 'hg diff', I'm *always* surprised when it shows a subset of
the expected output because I'm in a subdir.

Perforce, which is the other SCM I'm most familiar with, shows output
for absolutely everything if you don't limit it to some subset of your
working tree.  I think this is annoying and wrong in the other
direction, but at least you can't be left with the mistaken impression
that everything has been committed.

There's a good reason for defaulting to the top of the repo: there's no
other pathname syntax to refer to it.  If you want to find the status of
'.', then 'hg status .' is an economical way to get the output you
want.  But at present, if you want to get the status of the whole repo
regardless of your cwd, there's no clean way to do it; you have to
determine the path to the top of the repo, and then do 'hg status' on
it.  Adding a new piece of pathname syntax for referring to the top of
the repo doesn't seem like a good idea.

Also, there's an inconsistency in hg's behaviour at the moment: 'hg
commit' will commit everything in the whole repo, regardless of your
cwd; 'hg commit .' will commit things in the current directory.  I would
argue that commit is right, and the other commands should operate similarly.

That said, this kind of UI change is annoying to do; changing the
behaviour will bite people (unless everyone agrees that the change is an
unalloyed improvement).  I'm not a fan of config or command line
options, but this seems like the sort of user preference which needs one.

CVS always works from '.', but that's because there's no real notion of
the "top" of a CVS tree; CVS effectively works on a directory by
directory basis.  SVN copies CVS's behaviour, I think for the same
reason.  It seems that most of the SCMs which have a notion of a top
working directory will use that directory as the default.

    J
msg82 (view) Author: mpm Date: 2005-10-27.18:35:24
This is how it was to start with. Then everyone insisted that
operations in subdirs should show subdirs. And thus it's been that way
since 0.5 or so. Changing it back is going to need a stronger argument
than "vocal subset of users prefers it", including comparisons to
multiple other systems.
msg80 (view) Author: tonfa Date: 2005-10-27.12:09:14
The following patch makes all commands to be consistent:
if no patterns are given it is repo-wide
else it works in the subdir.

This break some usage (if you used to do 'hg diff' to diff the current
dir for example you will have to do 'hg diff .')

# HG changeset patch
# User Benoit Boissinot <benoit.boissinot@ens-lyon.org>
# Node ID dc24d549222f223cd09aae194241f704b2fca3a5
# Parent  214f42f23a3bbf04efb96ec1c02097cad11d018d
make all commands be repo-wide by default

- refactor code in commands.py so that:
  if no pattern is given, the command will be repo-wide
  else it will work on the working dir
- update the doc
- fix the tests

diff -r 214f42f23a3b -r dc24d549222f mercurial/commands.py
--- a/mercurial/commands.py	Wed Oct 26 16:32:50 2005 -0700
+++ b/mercurial/commands.py	Thu Oct 27 14:03:57 2005 +0200
@@ -31,13 +31,17 @@
         return [util.normpath(os.path.join(cwd, x)) for x in args]
     return args

-def matchpats(repo, cwd, pats=[], opts={}, head=''):
+def matchpats(repo, pats=[], opts={}, head=''):
+    cwd = repo.getcwd()
+    if not pats and cwd:
+        opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
+        opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
+        cwd = ''
     return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'),
-                        opts.get('exclude'), head)
+                        opts.get('exclude'), head) + (cwd,)

 def makewalk(repo, pats, opts, head=''):
-    cwd = repo.getcwd()
-    files, matchfn, anypats = matchpats(repo, cwd, pats, opts, head)
+    files, matchfn, anypats, cwd = matchpats(repo, pats, opts, head)
     exact = dict(zip(files, files))
     def walk():
         for src, fn in repo.walk(files=files, match=matchfn):
@@ -49,7 +53,7 @@
     for r in results:
         yield r

-def walkchangerevs(ui, repo, cwd, pats, opts):
+def walkchangerevs(ui, repo, pats, opts):
     '''Iterate over files and the revs they changed in.

     Callers most commonly need to iterate backwards over the history
@@ -79,12 +83,7 @@
     if repo.changelog.count() == 0:
         return [], False

-    cwd = repo.getcwd()
-    if not pats and cwd:
-        opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
-        opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
-    files, matchfn, anypats = matchpats(repo, (pats and cwd) or '',
-                                        pats, opts)
+    files, matchfn, anypats, cwd = matchpats(repo, pats, opts)
     revs = map(int, revrange(ui, repo, opts['rev'] or ['tip:0']))
     wanted = {}
     slowpath = anypats
@@ -482,8 +481,7 @@

     The files will be added to the repository at the next commit.

-    If no names are given, add all files in the current directory and
-    its subdirectories.
+    If no names are given, add all files in the repository.
     """

     names = []
@@ -741,7 +739,7 @@
     Commit changes to the given files into the repository.

     If a list of files is omitted, all changes reported by "hg status"
-    from the root of the repository will be commited.
+    will be commited.

     The HGEDITOR or EDITOR environment variables are used to start an
     editor to add a commit comment.
@@ -764,12 +762,7 @@

     if opts['addremove']:
         addremove(ui, repo, *pats, **opts)
-    cwd = repo.getcwd()
-    if not pats and cwd:
-        opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
-        opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
-    fns, match, anypats = matchpats(repo, (pats and repo.getcwd()) or '',
-                                    pats, opts)
+    fns, match, anypats, cwd = matchpats(repo, pats, opts)
     if pats:
         c, a, d, u = repo.changes(files=fns, match=match)
         files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r']
@@ -1025,7 +1018,7 @@
         ui.write("%s\n" % line.rstrip())

 def diff(ui, repo, *pats, **opts):
-    """diff working directory (or selected files)
+    """diff repository (or selected files)

     Show differences between revisions for the specified files.

@@ -1051,7 +1044,7 @@
     if len(revs) > 2:
         raise util.Abort(_("too many revisions to diff"))

-    fns, matchfn, anypats = matchpats(repo, repo.getcwd(), pats, opts)
+    fns, matchfn, anypats, cwd = matchpats(repo, pats, opts)

     dodiff(sys.stdout, ui, repo, node1, node2, fns, match=matchfn,
            text=opts['text'])
@@ -1222,7 +1215,7 @@

     fstate = {}
     skip = {}
-    changeiter, getchange = walkchangerevs(ui, repo, repo.getcwd(), pats, opts)
+    changeiter, getchange = walkchangerevs(ui, repo, pats, opts)
     count = 0
     incrementing = False
     for st, rev, fns in changeiter:
@@ -1481,12 +1474,7 @@
                 self.write(*args)
         def __getattr__(self, key):
             return getattr(self.ui, key)
-    cwd = repo.getcwd()
-    if not pats and cwd:
-        opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
-        opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
-    changeiter, getchange = walkchangerevs(ui, repo, (pats and cwd) or '',
-                                           pats, opts)
+    changeiter, getchange = walkchangerevs(ui, repo, pats, opts)
     for st, rev, fns in changeiter:
         if st == 'window':
             du = dui(ui)
@@ -1792,8 +1780,7 @@
     If a directory is given, all files in that directory and its
     subdirectories are reverted.

-    If no arguments are given, all files in the current directory and
-    its subdirectories are reverted.
+    If no arguments are given, all files in the repository are reverted.
     """
     node = opts['rev'] and repo.lookup(opts['rev']) or \
            repo.dirstate.parents()[0]
@@ -1961,9 +1948,8 @@
 def status(ui, repo, *pats, **opts):
     """show changed files in the working directory

-    Show changed files in the working directory.  If no names are
-    given, all files are shown.  Otherwise, only files matching the
-    given names are shown.
+    Show changed files in the repository.  If names are
+    given, only files that match are shown.

     The codes used to show the status of files are:
     M = modified
@@ -1972,8 +1958,7 @@
     ? = not tracked
     """

-    cwd = repo.getcwd()
-    files, matchfn, anypats = matchpats(repo, cwd, pats, opts)
+    files, matchfn, anypats, cwd = matchpats(repo, pats, opts)
     (c, a, d, u) = [[util.pathto(cwd, x) for x in n]
                     for n in repo.changes(files=files, match=matchfn)]

diff -r 214f42f23a3b -r dc24d549222f tests/test-help.out
--- a/tests/test-help.out	Wed Oct 26 16:32:50 2005 -0700
+++ b/tests/test-help.out	Thu Oct 27 14:03:57 2005 +0200
@@ -6,22 +6,22 @@
  annotate   show changeset information per file line
  clone      make a copy of an existing repository
  commit     commit the specified files or all outstanding changes
- diff       diff working directory (or selected files)
- export     dump the header and diffs for one or more changesets
- init       create a new repository in the given directory
- log        show revision history of entire repository or files
- pull       pull changes from the specified source
- push       push changes to the specified destination
- remove     remove the specified files on the next commit
- revert     revert modified files or dirs back to their unmodified states
- serve      export the repository via HTTP
- status     show changed files in the working directory
- update     update or merge working directory
- add        add the specified files on the next commit
- annotate   show changeset information per file line
- clone      make a copy of an existing repository
- commit     commit the specified files or all outstanding changes
- diff       diff working directory (or selected files)
+ diff       diff repository (or selected files)
+ export     dump the header and diffs for one or more changesets
+ init       create a new repository in the given directory
+ log        show revision history of entire repository or files
+ pull       pull changes from the specified source
+ push       push changes to the specified destination
+ remove     remove the specified files on the next commit
+ revert     revert modified files or dirs back to their unmodified states
+ serve      export the repository via HTTP
+ status     show changed files in the working directory
+ update     update or merge working directory
+ add        add the specified files on the next commit
+ annotate   show changeset information per file line
+ clone      make a copy of an existing repository
+ commit     commit the specified files or all outstanding changes
+ diff       diff repository (or selected files)
  export     dump the header and diffs for one or more changesets
  init       create a new repository in the given directory
  log        show revision history of entire repository or files
@@ -44,7 +44,7 @@
  clone       make a copy of an existing repository
  commit      commit the specified files or all outstanding changes
  copy        mark files as copied for the next commit
- diff        diff working directory (or selected files)
+ diff        diff repository (or selected files)
  export      dump the header and diffs for one or more changesets
  forget      don't add the specified files on the next commit
  grep        search for a pattern in specified files and revisions
@@ -86,7 +86,7 @@
  clone       make a copy of an existing repository
  commit      commit the specified files or all outstanding changes
  copy        mark files as copied for the next commit
- diff        diff working directory (or selected files)
+ diff        diff repository (or selected files)
  export      dump the header and diffs for one or more changesets
  forget      don't add the specified files on the next commit
  grep        search for a pattern in specified files and revisions
@@ -128,8 +128,7 @@

     The files will be added to the repository at the next commit.

-    If no names are given, add all files in the current directory and
-    its subdirectories.
+    If no names are given, add all files in the repository.

 options:

@@ -144,8 +143,7 @@

     The files will be added to the repository at the next commit.

-    If no names are given, add all files in the current directory and
-    its subdirectories.
+    If no names are given, add all files in the repository.

 options:

@@ -153,7 +151,7 @@
  -X --exclude  exclude names matching the given patterns
 hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...

-diff working directory (or selected files)
+diff repository (or selected files)

     Show differences between revisions for the specified files.

@@ -179,9 +177,8 @@

 show changed files in the working directory

-    Show changed files in the working directory.  If no names are
-    given, all files are shown.  Otherwise, only files matching the
-    given names are shown.
+    Show changed files in the repository.  If names are
+    given, only files that match are shown.

     The codes used to show the status of files are:
     M = modified
@@ -211,7 +208,7 @@
  annotate   show changeset information per file line
  clone      make a copy of an existing repository
  commit     commit the specified files or all outstanding changes
- diff       diff working directory (or selected files)
+ diff       diff repository (or selected files)
  export     dump the header and diffs for one or more changesets
  init       create a new repository in the given directory
  log        show revision history of entire repository or files
@@ -231,14 +228,14 @@
  annotate   show changeset information per file line
  clone      make a copy of an existing repository
  commit     commit the specified files or all outstanding changes
- diff       diff working directory (or selected files)
- export     dump the header and diffs for one or more changesets
- init       create a new repository in the given directory
- log        show revision history of entire repository or files
- pull       pull changes from the specified source
- push       push changes to the specified destination
- remove     remove the specified files on the next commit
- revert     revert modified files or dirs back to their unmodified states
- serve      export the repository via HTTP
- status     show changed files in the working directory
- update     update or merge working directory
+ diff       diff repository (or selected files)
+ export     dump the header and diffs for one or more changesets
+ init       create a new repository in the given directory
+ log        show revision history of entire repository or files
+ pull       pull changes from the specified source
+ push       push changes to the specified destination
+ remove     remove the specified files on the next commit
+ revert     revert modified files or dirs back to their unmodified states
+ serve      export the repository via HTTP
+ status     show changed files in the working directory
+ update     update or merge working directory
diff -r 214f42f23a3b -r dc24d549222f tests/test-walk
--- a/tests/test-walk	Wed Oct 26 16:32:50 2005 -0700
+++ b/tests/test-walk	Thu Oct 27 14:03:57 2005 +0200
@@ -20,14 +20,14 @@
 hg commit -m "commit #0" -d "0 0"
 hg debugwalk
 cd mammals
-hg debugwalk
+hg debugwalk .
 hg debugwalk Procyonidae
 cd Procyonidae
-hg debugwalk
+hg debugwalk .
 hg debugwalk ..
 cd ..
 hg debugwalk ../beans
-hg debugwalk
+hg debugwalk .
 cd ..
 hg debugwalk -Ibeans
 hg debugwalk 'glob:mammals/../beans/b*'
msg79 (view) Author: tonfa Date: 2005-10-27.08:37:26
With simple refactoring we could do something like this:
if there is no pattern, it default to working repowide
if there are patterns, it operates on the subdir

so "hg status" while be repo-wide
and "hg status ." while be only for the subdir
msg75 (view) Author: tksoh Date: 2005-10-27.04:32:09
This let us perform a repo-wide operation from a subdir.

note: this is not the same as --cwd or --repository
History
Date User Action Args
2005-12-15 17:29:12ThomasAHsetstatus: testing -> resolved
nosy: mpm, tonfa, tksoh
messages: + msg302
2005-12-07 09:15:35tonfasetstatus: in-progress -> testing
nosy: mpm, tonfa, tksoh
2005-11-21 17:20:16tonfasetnosy: mpm, tonfa, tksoh
messages: + msg226
title: add a global option to start running commands fromrepo root -> add a global option to start running commands from repo root
2005-10-31 18:46:46mpmsetstatus: chatting -> in-progress
nosy: + tonfa, mpm
2005-10-30 09:30:24tonfasetmessages: + msg102
2005-10-30 07:31:16xiaofeng.lingsetmessages: + msg101
title: add a global option to start running commands from repo root -> add a global option to start running commands fromrepo root
2005-10-29 21:34:37jsgfsetmessages: + msg100
2005-10-29 21:03:55mpmsetmessages: + msg98
2005-10-27 21:21:30jsgfsetmessages: + msg86
2005-10-27 18:35:26mpmsetmessages: + msg82
2005-10-27 12:09:15tonfasetmessages: + msg80
2005-10-27 08:37:26tonfasetstatus: unread -> chatting
messages: + msg79
2005-10-27 04:32:11tksohcreate