merge with crew
authorMatt Mackall <mpm@selenic.com>
Fri, 05 Apr 2013 12:21:38 -0500
changeset 18880 565482e2ac6b
parent 18879 93b03a222c3e (current diff)
parent 18878 3cfaace0441e (diff)
child 18883 667441789d25
merge with crew
--- a/contrib/perf.py	Fri Apr 05 12:20:14 2013 -0500
+++ b/contrib/perf.py	Fri Apr 05 12:21:38 2013 -0500
@@ -2,7 +2,7 @@
 '''helper extension to measure performance'''
 
 from mercurial import cmdutil, scmutil, util, match, commands, obsolete
-from mercurial import repoview, branchmap, merge
+from mercurial import repoview, branchmap, merge, copies
 import time, os, sys
 
 cmdtable = {}
@@ -158,6 +158,14 @@
                                acceptremote=True)
     timer(d)
 
+@command('perfpathcopies', [], "REV REV")
+def perfpathcopies(ui, repo, rev1, rev2):
+    ctx1 = scmutil.revsingle(repo, rev1, rev1)
+    ctx2 = scmutil.revsingle(repo, rev2, rev2)
+    def d():
+        copies.pathcopies(ctx1, ctx2)
+    timer(d)
+
 @command('perfmanifest')
 def perfmanifest(ui, repo):
     def d():
--- a/mercurial/copies.py	Fri Apr 05 12:20:14 2013 -0500
+++ b/mercurial/copies.py	Fri Apr 05 12:21:38 2013 -0500
@@ -133,11 +133,13 @@
     # we currently don't try to find where old files went, too expensive
     # this means we can miss a case like 'hg rm b; hg cp a b'
     cm = {}
-    for f in b:
-        if f not in a:
-            ofctx = _tracefile(b[f], a)
-            if ofctx:
-                cm[f] = ofctx.path()
+    missing = set(b.manifest().iterkeys())
+    missing.difference_update(a.manifest().iterkeys())
+
+    for f in missing:
+        ofctx = _tracefile(b[f], a)
+        if ofctx:
+            cm[f] = ofctx.path()
 
     # combine copies from dirstate if necessary
     if w is not None: