Mercurial > hgsubversion
changeset 117:3afe404042a3
Add a disabled test for unrelated branches
The fix is not obvious but preserving the test helps fixing other stuff.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sat, 29 Nov 2008 11:25:01 -0600 |
parents | 30580c05dccc |
children | a0401f6e14dd |
files | tests/fixtures/unrelatedbranch.sh tests/fixtures/unrelatedbranch.svndump tests/run.py tests/test_fetch_branches.py |
diffstat | 4 files changed, 239 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
new file mode 100755 --- /dev/null +++ b/tests/fixtures/unrelatedbranch.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# +# Generate unrelatedbranch.svndump +# + +mkdir temp +cd temp + +mkdir project-orig +cd project-orig +mkdir trunk +mkdir branches +cd .. + +svnadmin create testrepo +svnurl=file://`pwd`/testrepo +svn import project-orig $svnurl -m "init project" + +svn co $svnurl project +cd project/trunk +echo a > a +svn add a +svn ci -m "add a in trunk" +cd ../branches +# Create an unrelated branch with another file. It used to lead the converter +# to think branch1 was a copy of trunk, even without copy information. +mkdir branch1 +echo b > branch1/b +svn add branch1 +svn ci -m "add b in branch1" +# Make a real branch too for comparison +svn cp ../trunk branch2 +echo b > branch2/b +svn add branch2/b +svn ci -m "add b to branch2" +cd ../.. + +svnadmin dump testrepo > ../unrelatedbranch.svndump
new file mode 100644 --- /dev/null +++ b/tests/fixtures/unrelatedbranch.svndump @@ -0,0 +1,172 @@ +SVN-fs-dump-format-version: 2 + +UUID: c79f8bc0-a944-4a5d-aaa5-0ce23b313891 + +Revision-number: 0 +Prop-content-length: 56 +Content-length: 56 + +K 8 +svn:date +V 27 +2008-11-23T18:54:03.376021Z +PROPS-END + +Revision-number: 1 +Prop-content-length: 114 +Content-length: 114 + +K 7 +svn:log +V 12 +init project +K 10 +svn:author +V 7 +pmezard +K 8 +svn:date +V 27 +2008-11-23T18:54:03.444309Z +PROPS-END + +Node-path: branches +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: trunk +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Revision-number: 2 +Prop-content-length: 116 +Content-length: 116 + +K 7 +svn:log +V 14 +add a in trunk +K 10 +svn:author +V 7 +pmezard +K 8 +svn:date +V 27 +2008-11-23T18:54:04.175530Z +PROPS-END + +Node-path: trunk/a +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 2 +Text-content-md5: 60b725f10c9c85c70d97880dfe8191b3 +Content-length: 12 + +PROPS-END +a + + +Revision-number: 3 +Prop-content-length: 118 +Content-length: 118 + +K 7 +svn:log +V 16 +add b in branch1 +K 10 +svn:author +V 7 +pmezard +K 8 +svn:date +V 27 +2008-11-23T18:54:05.192583Z +PROPS-END + +Node-path: branches/branch1 +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: branches/branch1/b +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 2 +Text-content-md5: 3b5d5c3712955042212316173ccf37be +Content-length: 12 + +PROPS-END +b + + +Revision-number: 4 +Prop-content-length: 118 +Content-length: 118 + +K 7 +svn:log +V 16 +add b to branch2 +K 10 +svn:author +V 7 +pmezard +K 8 +svn:date +V 27 +2008-11-23T18:54:07.185050Z +PROPS-END + +Node-path: branches/branch2 +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 1 +Node-copyfrom-path: trunk +Prop-content-length: 34 +Content-length: 34 + +K 13 +svn:mergeinfo +V 0 + +PROPS-END + + +Node-path: branches/branch2/a +Node-kind: file +Node-action: add +Node-copyfrom-rev: 2 +Node-copyfrom-path: trunk/a +Text-copy-source-md5: 60b725f10c9c85c70d97880dfe8191b3 + + +Node-path: branches/branch2/b +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 2 +Text-content-md5: 3b5d5c3712955042212316173ccf37be +Content-length: 12 + +PROPS-END +b + +
--- a/tests/run.py +++ b/tests/run.py @@ -4,6 +4,7 @@ import unittest sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +import test_fetch_branches import test_fetch_command import test_fetch_command_regexes import test_fetch_renames @@ -15,7 +16,8 @@ import test_push_eol import test_tags def suite(): - return unittest.TestSuite([test_fetch_command.suite(), + return unittest.TestSuite([test_fetch_branches.suite(), + test_fetch_command.suite(), test_fetch_command_regexes.suite(), test_fetch_renames.suite(), test_fetch_truncated.suite(),
new file mode 100644 --- /dev/null +++ b/tests/test_fetch_branches.py @@ -0,0 +1,26 @@ +import sys +import unittest + +import test_util + + +class TestFetchBranches(test_util.TestBase): + def _load_fixture_and_fetch(self, fixture_name, stupid): + return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, + self.wc_path, stupid=stupid) + + def test_unrelatedbranch(self, stupid=False): + repo = self._load_fixture_and_fetch('unrelatedbranch.svndump', stupid) + heads = [repo[n] for n in repo.heads()] + heads = dict([(ctx.branch(), ctx) for ctx in heads]) + # Let these tests disabled yet as the fix is not obvious + #self.assertEqual(heads['branch1'].manifest().keys(), ['b']) + #self.assertEqual(heads['branch2'].manifest().keys(), ['a', 'b']) + + def test_unrelatedbranch_stupid(self): + self.test_unrelatedbranch(True) + +def suite(): + all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBranches), + ] + return unittest.TestSuite(all)