[PATCH 2 of 2] log: implement --removed

Nicolas Dumazet nicdumz at gmail.com
Sun Jul 4 09:20:56 CDT 2010


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1278252064 -32400
# Branch stable
# Node ID 43fedec1663b33b5c12a5b77fa6c4614fc250871
# Parent  c6b0a3edb48a91859df9949ebeb11802becfe9f8
log: implement --removed

This log option was added in 4d988b7412f2 without ever really being implemented.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1102,12 +1102,16 @@
             raise util.Abort(_('can only follow copies/renames for explicit '
                                'filenames'))
 
+        removed = opts.get('removed')
         # The slow path checks files modified in every changeset.
         for i in sorted(revs):
             ctx = change(i)
             matches = filter(match, ctx.files())
             fncache[ctx.rev()] = matches
-            if matches:
+            if removed:
+                if set(matches).difference(ctx.manifest()):
+                    wanted.add(ctx.rev())
+            elif matches:
                 wanted.add(ctx.rev())
 
     class followfilter(object):
diff --git a/tests/test-log b/tests/test-log
--- a/tests/test-log
+++ b/tests/test-log
@@ -22,6 +22,8 @@
 hg ci -me -d '5 0'
 
 hg log a
+echo % --removed
+hg log --removed a
 echo % -f, directory
 hg log -f dir
 echo % -f, but no args
diff --git a/tests/test-log.out b/tests/test-log.out
--- a/tests/test-log.out
+++ b/tests/test-log.out
@@ -4,6 +4,12 @@
 date:        Thu Jan 01 00:00:01 1970 +0000
 summary:     a
 
+% --removed
+changeset:   3:7c6c671bb7cc
+user:        test
+date:        Thu Jan 01 00:00:04 1970 +0000
+summary:     d
+
 % -f, directory
 abort: cannot follow nonexistent file: "dir"
 % -f, but no args


More information about the Mercurial-devel mailing list