changeset 8989:85b81cac9613

addremove: pass unknown and deleted to findrenames directly again
author Matt Mackall <mpm@selenic.com>
date Tue, 30 Jun 2009 16:11:42 -0500
parents 1247751d9bf8
children 627399330c7d
files mercurial/cmdutil.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Jun 30 15:56:08 2009 -0500
+++ b/mercurial/cmdutil.py	Tue Jun 30 16:11:42 2009 -0500
@@ -265,14 +265,15 @@
 def matchfiles(repo, files):
     return _match.exact(repo.root, repo.getcwd(), files)
 
-def findrenames(repo, match, threshold):
+def findrenames(repo, added, removed, threshold):
     '''find renamed files -- yields (before, after, score) tuples'''
-    added, removed = repo.status(match=match)[1:3]
     ctx = repo['.']
     for a in added:
         aa = repo.wread(a)
         bestname, bestscore = None, threshold
         for r in removed:
+            if r not in ctx:
+                continue
             rr = ctx.filectx(r).data()
 
             # bdiff.blocks() returns blocks of matching lines
@@ -322,7 +323,7 @@
         repo.remove(deleted)
         repo.add(unknown)
     if similarity > 0:
-        for old, new, score in findrenames(repo, m, similarity):
+        for old, new, score in findrenames(repo, unknown, deleted, similarity):
             if repo.ui.verbose or not m.exact(old) or not m.exact(new):
                 repo.ui.status(_('recording removal of %s as rename to %s '
                                  '(%d%% similar)\n') %