[PATCH] Add --rev option to status

Brendan Cully brendan at kublai.com
Tue Oct 17 21:20:02 CDT 2006


# HG changeset patch
# User Brendan Cully <brendan at kublai.com>
# Date 1161137977 25200
# Node ID ae0ea0d3776ae42d88efa812bcdc2fcfc3b2a3a1
# Parent  d96429ddc8e287457053c744f82e1279ed19b02a
Add --rev option to status

diff -r d96429ddc8e2 -r ae0ea0d3776a mercurial/commands.py
--- a/mercurial/commands.py	Tue Oct 17 19:04:13 2006 -0500
+++ b/mercurial/commands.py	Tue Oct 17 19:19:37 2006 -0700
@@ -2536,6 +2536,9 @@ def status(ui, repo, *pats, **opts):
     files that match are shown.  Files that are clean or ignored, are
     not listed unless -c (clean), -i (ignored) or -A is given.
 
+    If one revision is given, it is used as the base revision.
+    If two revisions are given, the difference between them is shown.
+
     The codes used to show the status of files are:
     M = modified
     A = added
@@ -2549,11 +2552,21 @@ def status(ui, repo, *pats, **opts):
 
     all = opts['all']
 
+    revs = opts.get('rev')
+    node1 = node2 = None
+    if revs:
+        node1 = repo.lookup(revs.pop(0))
+    if revs:
+        node2 = repo.lookup(revs.pop(0))
+    if revs:
+        raise util.Abort(_('no more than two revisions are permitted'))
+
     files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
     cwd = (pats and repo.getcwd()) or ''
     modified, added, removed, deleted, unknown, ignored, clean = [
         [util.pathto(cwd, x) for x in n]
-        for n in repo.status(files=files, match=matchfn,
+        for n in repo.status(node1=node1, node2=node2, files=files,
+                             match=matchfn,
                              list_ignored=all or opts['ignored'],
                              list_clean=all or opts['clean'])]
 
@@ -3099,6 +3112,7 @@ table = {
           ('C', 'copies', None, _('show source of copied files')),
           ('0', 'print0', None,
            _('end filenames with NUL, for use with xargs')),
+          ('', 'rev', [], _('show difference from REVISION')),
          ] + walkopts,
          _('hg status [OPTION]... [FILE]...')),
     "tag":


More information about the Mercurial-devel mailing list