log: slowpath: only walk specified revision range during preparation
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Tue, 20 Jul 2010 14:13:33 +0900
changeset 11631 dbb98d8fbcaf
parent 11630 0c23085f051f
child 11632 f418d2570920
log: slowpath: only walk specified revision range during preparation Even with --removed, it does not make sense to examine changesets outside of the revision range that was specified by the user: the last phase only yields a subset of (revs), preparation phase hence only has to examine (revs) to fill correctly fncache.
mercurial/cmdutil.py
tests/test-log
tests/test-log.out
--- a/mercurial/cmdutil.py	Tue Jul 20 15:07:10 2010 -0500
+++ b/mercurial/cmdutil.py	Tue Jul 20 14:13:33 2010 +0900
@@ -1106,15 +1106,7 @@
                                'filenames'))
 
         # The slow path checks files modified in every changeset.
-        if opts.get('removed'):
-            # --removed wants to yield the changes where the file
-            # was removed, this means that we have to explore all
-            # changesets, effectively ignoring the revisions that
-            # had been passed as arguments
-            revlist = xrange(nullrev, len(repo) - 1)
-        else:
-            revlist = sorted(revs)
-        for i in revlist:
+        for i in sorted(revs):
             ctx = change(i)
             matches = filter(match, ctx.files())
             if matches:
--- a/tests/test-log	Tue Jul 20 15:07:10 2010 -0500
+++ b/tests/test-log	Tue Jul 20 14:13:33 2010 +0900
@@ -62,6 +62,11 @@
 echo '% log -p d'
 hg log -pv d
 
+echo '% log --removed file'
+hg log --removed -v a
+echo '% log --removed revrange file'
+hg log --removed -v -r0:2 a
+
 # log --follow tests
 hg init ../follow
 cd ../follow
--- a/tests/test-log.out	Tue Jul 20 15:07:10 2010 -0500
+++ b/tests/test-log.out	Tue Jul 20 14:13:33 2010 +0900
@@ -196,6 +196,32 @@
 @@ -0,0 +1,1 @@
 +a
 
+% log --removed file
+changeset:   3:7c6c671bb7cc
+user:        test
+date:        Thu Jan 01 00:00:04 1970 +0000
+files:       a b d
+description:
+d
+
+
+changeset:   0:8580ff50825a
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+files:       a
+description:
+a
+
+
+% log --removed revrange file
+changeset:   0:8580ff50825a
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+files:       a
+description:
+a
+
+
 adding base
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 adding b1