changeset 496:5e0dfe59d4c3

copies: fix under-reporting of copies in hg
author Augie Fackler <durin42@gmail.com>
date Fri, 16 Oct 2009 19:09:25 -0400
parents 44bde69b6c49
children cad864ed29de
files hgsubversion/editor.py hgsubversion/stupid.py tests/test_fetch_renames.py
diffstat 3 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/editor.py
+++ b/hgsubversion/editor.py
@@ -278,8 +278,9 @@ class HgEditor(delta.Editor):
             parentid = self.meta.get_parent_revision(self.current.rev.revnum, branch)
             if parentid != revlog.nullid:
                 parentctx = self.repo.changectx(parentid)
-                if util.aresamefiles(parentctx, cp_f_ctx, copies.values()):
-                    self.current.copies.update(copies)
+                for k, v in copies.iteritems():
+                    if util.aresamefiles(parentctx, cp_f_ctx, [v]):
+                        self.current.copies.update({k: v})
         return path
 
     @ieditor
--- a/hgsubversion/stupid.py
+++ b/hgsubversion/stupid.py
@@ -322,10 +322,10 @@ def getcopies(svn, meta, branch, branchp
         sourcectx = getctx(rev)
         if sourcectx is None:
             continue
-        sources = [s[1] for s in copies]
-        if not util.aresamefiles(sourcectx, parentctx, sources):
-            continue
-        hgcopies.update(copies)
+        for k, v in copies:
+            if not util.aresamefiles(sourcectx, parentctx, [v]):
+                continue
+            hgcopies.update({k: v})
     return hgcopies
 
 def fetch_externals(svn, branchpath, r, parentctx):
--- a/tests/test_fetch_renames.py
+++ b/tests/test_fetch_renames.py
@@ -39,7 +39,10 @@ class TestFetchRenames(test_util.TestBas
             9: {
                 'unchanged2': ('unchanged', 'unchanged\n'),
                 'unchangeddir2/f': ('unchangeddir/f', 'unchanged2\n'),
-                }
+                },
+            10: {
+                 'groupdir2/b': ('groupdir/b', 'b\n')
+                 },
             }
         for rev in repo:
             ctx = repo[rev]