diff mercurial/commands.py @ 10014:54cd28258ea7

status: add the --change option to display files changed in a revision This option is similar to the one already used for the diff command. Unfortunately, the c and C short option are already used for status, so there is no corresponding short option. However, there is no short option for --rev either, so that's consistent.
author Gilles Moris <gilles.moris@free.fr>
date Mon, 30 Nov 2009 23:51:06 +0100
parents 46c6bac41dc6
children b5f352f33520
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Dec 01 09:53:02 2009 +0900
+++ b/mercurial/commands.py	Mon Nov 30 23:51:06 2009 +0100
@@ -2842,7 +2842,8 @@
 
     If one revision is given, it is used as the base revision.
     If two revisions are given, the differences between them are
-    shown.
+    shown. The --change option can also be used as a shortcut to list
+    the changed files of a revision from its first parent.
 
     The codes used to show the status of files are::
 
@@ -2856,7 +2857,18 @@
         = origin of the previous file listed as A (added)
     """
 
-    node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
+    revs = opts.get('rev')
+    change = opts.get('change')
+
+    if revs and change:
+        msg = _('cannot specify --rev and --change at the same time')
+        raise util.Abort(msg)
+    elif change:
+        node2 = repo.lookup(change)
+        node1 = repo[node2].parents()[0].node()
+    else:
+        node1, node2 = cmdutil.revpair(repo, revs)
+
     cwd = (pats and repo.getcwd()) or ''
     end = opts.get('print0') and '\0' or '\n'
     copy = {}
@@ -3660,6 +3672,7 @@
           ('0', 'print0', None,
            _('end filenames with NUL, for use with xargs')),
           ('', 'rev', [], _('show difference from revision')),
+          ('', 'change', '', _('list the changed files of a revision')),
          ] + walkopts,
          _('[OPTION]... [FILE]...')),
     "tag":