changeset 585:c3ba4ca81d16

editor: fix replaced files content in replay mode
author Patrick Mezard <pmezard@gmail.com>
date Tue, 02 Mar 2010 17:06:06 +0100
parents d000b9a361e4
children 704d2ce1d906
files hgsubversion/editor.py tests/test_fetch_branches.py
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/editor.py
+++ b/hgsubversion/editor.py
@@ -209,8 +209,11 @@ class HgEditor(delta.Editor):
         if not from_file:
             self.current.missing.add(path)
             return
+        # Use exact=True because during replacements ('R' action) we select
+        # replacing branch as parent, but svn delta editor provides delta
+        # agains replaced branch.
         ha = self.meta.get_parent_revision(copyfrom_revision + 1,
-                                           from_branch)
+                                           from_branch, True)
         ctx = self.repo.changectx(ha)
         if from_file in ctx:
             fctx = ctx.filectx(from_file)
--- a/tests/test_fetch_branches.py
+++ b/tests/test_fetch_branches.py
@@ -145,8 +145,7 @@ class TestFetchBranches(test_util.TestBa
         self.assertEqual('0', ctx.extra().get('close', '0'))
         self.assertEqual('branch1', ctx.branch())
         self.assertEqual('c\n', ctx['c'].data())
-        # a replacement does not work yet
-        #self.assertEqual('d\n', ctx['a'].data())
+        self.assertEqual('d\n', ctx['a'].data())
 
     def test_replace_branch_with_branch_stupid(self, stupid=False):
         self.test_replace_branch_with_branch(True)