Add name matching to status command.
authorBryan O'Sullivan <bos@serpentine.com>
Wed, 20 Jul 2005 03:01:23 -0800
changeset 731 91ca3afab8e8
parent 730 d2dc7663d512
child 732 ba0b6d17a6de
Add name matching to status command.
doc/hg.1.txt
mercurial/commands.py
--- a/doc/hg.1.txt	Wed Jul 20 02:57:20 2005 -0800
+++ b/doc/hg.1.txt	Wed Jul 20 03:01:23 2005 -0800
@@ -319,8 +319,10 @@
     -n, --name <name>        name to show in web pages (default: working dir)
     -t, --templatedir <path> web templates to use
 
-status::
-    Show changed files in the working directory.
+status [options] [files]::
+    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.
 
     The codes used to show the status of files are:
     
@@ -329,6 +331,11 @@
     R = removed
     ? = not tracked
 
+    options:
+
+    -I, --include <pat>  include directories matching the given patterns
+    -X, --exclude <pat>  exclude directories matching the given patterns
+
 tag [-l -t <text> -d <datecode> -u <user>] <name> [revision]::
     Name a particular revision using <name>.
     
--- a/mercurial/commands.py	Wed Jul 20 02:57:20 2005 -0800
+++ b/mercurial/commands.py	Wed Jul 20 03:01:23 2005 -0800
@@ -980,7 +980,7 @@
             ui.status('listening at http://%s/\n' % addr)
     httpd.serve_forever()
 
-def status(ui, repo):
+def status(ui, repo, *pats, **opts):
     '''show changed files in the working directory
 
     C = changed
@@ -988,7 +988,8 @@
     R = removed
     ? = not tracked'''
 
-    (c, a, d, u) = repo.changes()
+    (c, a, d, u) = repo.changes(match = matchpats(ui, repo.getcwd(),
+                                                  pats, opts))
     (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u))
 
     for f in c:
@@ -1192,7 +1193,10 @@
           ('', 'stdio', None, 'for remote clients'),
           ('t', 'templates', "", 'template map')],
          "hg serve [OPTION]..."),
-    "^status": (status, [], 'hg status'),
+    "^status": (status,
+                [('I', 'include', [], 'include path in search'),
+                 ('X', 'exclude', [], 'exclude path from search')],
+                'hg status [OPTION]... [FILE]...'),
     "tag":
         (tag,
          [('l', 'local', None, 'make the tag local'),