# HG changeset patch # User David Schleimer # Date 1396921486 25200 # Node ID 6b15eeb78c1a502f4a7ba7e2b18c290dba37ac8f # Parent d3c79072bc6ab856245183b6040e3878370a0c3e editor: fix replay handling for copied + modified symlinks We strip the 'link ' prefix from symlinks when we store it in Mercurial. We reapply it when we start editing the file via open_file, but not via add_file. this means that modified symlniks would replay correctly, but not copied and modified symlinks. This corrects that ommission. diff --git a/hgsubversion/editor.py b/hgsubversion/editor.py --- a/hgsubversion/editor.py +++ b/hgsubversion/editor.py @@ -380,7 +380,10 @@ class HgEditor(svnwrap.Editor): fctx = ctx.filectx(from_file) flags = fctx.flags() - self.current.set(path, fctx.data(), 'x' in flags, 'l' in flags) + base = fctx.data() + if 'l' in flags: + base = 'link ' + base + self.current.set(path, base, 'x' in flags, 'l' in flags) copypath = None if from_branch == branch: parentid = self.meta.get_parent_revision( @@ -389,7 +392,7 @@ class HgEditor(svnwrap.Editor): parentctx = self._getctx(parentid) if util.issamefile(parentctx, ctx, from_file): copypath = from_file - return self._openfile(path, fctx.data(), 'x' in flags, 'l' in flags, + return self._openfile(path, base, 'x' in flags, 'l' in flags, copypath, create=True) @svnwrap.ieditor diff --git a/tests/test_fetch_renames.py b/tests/test_fetch_renames.py --- a/tests/test_fetch_renames.py +++ b/tests/test_fetch_renames.py @@ -18,6 +18,10 @@ class TestFetchRenames(test_util.TestBas def test_rename(self): config = { 'hgsubversion.filestoresize': '0', + # we set this because we expect all of the copies to be + # handled via replay, and we want to notice if that + # changes. + 'hgsubversion.failonmissing': 'yes', } repo = self._load_fixture_and_fetch('renames.svndump', config=config) self._run_assertions(repo) @@ -25,6 +29,7 @@ class TestFetchRenames(test_util.TestBas def test_rename_with_prefix(self): config = { 'hgsubversion.filestoresize': '0', + 'hgsubversion.failonmissing': 'yes', } repo = self._load_fixture_and_fetch('renames_with_prefix.svndump', subdir='prefix',