Mercurial > hgsubversion
changeset 587:c06f59441f8e
editor: fix replaced directory copies
Known failures:
- Replaced directories copy records are wrong in stupid mode
- Replaced files copy records are probably wrong in all modes
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Tue, 02 Mar 2010 17:06:06 +0100 |
parents | 704d2ce1d906 |
children | 2723152c8111 |
files | hgsubversion/editor.py tests/fixtures/replace_branch_with_branch.sh tests/fixtures/replace_branch_with_branch.svndump tests/test_fetch_branches.py |
diffstat | 4 files changed, 84 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/editor.py +++ b/hgsubversion/editor.py @@ -262,7 +262,7 @@ class HgEditor(delta.Editor): assert br_path is not None tmp = source_branch, source_rev, self.current.rev.revnum self.meta.branches[branch] = tmp - new_hash = self.meta.get_parent_revision(source_rev + 1, source_branch) + new_hash = self.meta.get_parent_revision(source_rev + 1, source_branch, True) if new_hash == node.nullid: self.current.missing.add('%s/' % path) return path
--- a/tests/fixtures/replace_branch_with_branch.sh +++ b/tests/fixtures/replace_branch_with_branch.sh @@ -22,13 +22,17 @@ svn ci -m 'branch1' svn up echo b > branches/branch1/b echo d > branches/branch1/d -svn add branches/branch1/b branches/branch1/d +mkdir branches/branch1/dir +echo e > branches/branch1/dir/e +svn add branches/branch1/b branches/branch1/d branches/branch1/dir svn ci -m 'add b to branch1' svn cp trunk branches/branch2 svn ci -m 'branch2' svn up echo c > branches/branch2/c -svn add branches/branch2/c +mkdir branches/branch2/dir +echo e2 > branches/branch2/dir/e +svn add branches/branch2/c branches/branch2/dir svn ci -m 'add c to branch2' svn up @@ -38,6 +42,8 @@ cat > clobber.rsvn <<EOF rdelete branches/branch1 rcopy branches/branch2 branches/branch1 rcopy branches/branch1/d branches/branch1/a +rcopy branches/branch1/dir branches/branch1/dir +rcopy branches/branch1/dir branches/branch1/dir2 EOF python $RSVN --message=blah --username=evil `pwd`/repo < clobber.rsvn
--- a/tests/fixtures/replace_branch_with_branch.svndump +++ b/tests/fixtures/replace_branch_with_branch.svndump @@ -1,6 +1,6 @@ SVN-fs-dump-format-version: 2 -UUID: 9ccfc2a0-ffd9-470e-a000-ccb1f0fe21e5 +UUID: a88ce668-5208-4e23-8d73-bebfb2ebee53 Revision-number: 0 Prop-content-length: 56 @@ -9,7 +9,7 @@ Content-length: 56 K 8 svn:date V 27 -2010-02-24T20:15:47.286918Z +2010-03-01T20:45:07.143960Z PROPS-END Revision-number: 1 @@ -27,7 +27,7 @@ pmezard K 8 svn:date V 27 -2010-02-24T20:15:48.124168Z +2010-03-01T20:45:08.063083Z PROPS-END Node-path: branches @@ -76,7 +76,7 @@ pmezard K 8 svn:date V 27 -2010-02-24T20:15:51.070312Z +2010-03-01T20:45:11.044475Z PROPS-END Node-path: branches/branch1 @@ -101,7 +101,7 @@ pmezard K 8 svn:date V 27 -2010-02-24T20:15:53.123732Z +2010-03-01T20:45:13.068264Z PROPS-END Node-path: branches/branch1/b @@ -130,6 +130,28 @@ PROPS-END d +Node-path: branches/branch1/dir +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: branches/branch1/dir/e +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 2 +Text-content-md5: 9ffbf43126e33be52cd2bf7e01d627f9 +Text-content-sha1: 094e3afb2fe8dfe82f63731cdcd3b999f4856cff +Content-length: 12 + +PROPS-END +e + + Revision-number: 4 Prop-content-length: 108 Content-length: 108 @@ -145,7 +167,7 @@ pmezard K 8 svn:date V 27 -2010-02-24T20:15:55.095809Z +2010-03-01T20:45:15.045695Z PROPS-END Node-path: branches/branch2 @@ -170,7 +192,7 @@ pmezard K 8 svn:date V 27 -2010-02-24T20:15:57.098439Z +2010-03-01T20:45:17.065669Z PROPS-END Node-path: branches/branch2/c @@ -186,6 +208,28 @@ PROPS-END c +Node-path: branches/branch2/dir +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: branches/branch2/dir/e +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 3 +Text-content-md5: c18e1214a2500c0c3636092222f8a850 +Text-content-sha1: 4a078b075f259063b9a730521378f70ec3223238 +Content-length: 13 + +PROPS-END +e2 + + Revision-number: 6 Prop-content-length: 102 Content-length: 102 @@ -201,7 +245,7 @@ evil K 8 svn:date V 27 -2010-02-24T20:15:59.687871Z +2010-03-01T20:45:19.243252Z PROPS-END Node-path: branches/branch1 @@ -232,3 +276,23 @@ Text-copy-source-sha1: e983f374794de9c64 +Node-path: branches/branch1/dir +Node-kind: dir +Node-action: delete + +Node-path: branches/branch1/dir +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 5 +Node-copyfrom-path: branches/branch1/dir + + + + +Node-path: branches/branch1/dir2 +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 5 +Node-copyfrom-path: branches/branch1/dir + +
--- a/tests/test_fetch_branches.py +++ b/tests/test_fetch_branches.py @@ -141,11 +141,13 @@ class TestFetchBranches(test_util.TestBa self.assertEqual('branch1', ctx.branch()) # r5 is where the replacement takes place ctx = repo[5] - self.assertEqual(set(['a', 'c']), set(ctx)) + self.assertEqual(set(['a', 'c', 'dir/e', 'dir2/e']), set(ctx)) self.assertEqual('0', ctx.extra().get('close', '0')) self.assertEqual('branch1', ctx.branch()) self.assertEqual('c\n', ctx['c'].data()) self.assertEqual('d\n', ctx['a'].data()) + self.assertEqual('e\n', ctx['dir/e'].data()) + self.assertEqual('e\n', ctx['dir2/e'].data()) def test_replace_branch_with_branch_stupid(self, stupid=False): self.test_replace_branch_with_branch(True)