changeset 586:704d2ce1d906

editor: fix open_file() on replaced branch The mercurial parent revision was the replacing branch revision not the replaced one.
author Patrick Mezard <pmezard@gmail.com>
date Tue, 02 Mar 2010 17:06:06 +0100
parents c3ba4ca81d16
children c06f59441f8e
files hgsubversion/editor.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/editor.py
+++ b/hgsubversion/editor.py
@@ -166,17 +166,20 @@ class HgEditor(delta.Editor):
         if self.current.file in self.current.files:
             return
 
+        if not self.meta.is_path_valid(path):
+            return
+
         baserev = base_revision
         if baserev is None or baserev == -1:
             baserev = self.current.rev.revnum - 1
-        parent = self.meta.get_parent_revision(baserev + 1, branch)
-
+        # Use exact=True because during replacements ('R' action) we select
+        # replacing branch as parent, but svn delta editor provides delta
+        # agains replaced branch.
+        parent = self.meta.get_parent_revision(baserev + 1, branch, True)
         ctx = self.repo[parent]
-        if not self.meta.is_path_valid(path):
-            return
-
         if fpath not in ctx:
             self.current.missing.add(path)
+            return
 
         fctx = ctx.filectx(fpath)
         base = fctx.data()