Mercurial > hgsubversion
comparison tests/test_fetch_renames.py @ 73:9c1b53abefcb
fetch_command: support svn copy detection in stupid mode
| author | Patrick Mezard <pmezard@gmail.com> |
|---|---|
| date | Wed, 05 Nov 2008 13:37:08 +0100 |
| parents | 63ece4ea25c9 |
| children | 072010a271c6 |
comparison
equal
deleted
inserted
replaced
| 72:9ec2a12c12ae | 73:9c1b53abefcb |
|---|---|
| 21 | 21 |
| 22 def tearDown(self): | 22 def tearDown(self): |
| 23 shutil.rmtree(self.tmpdir) | 23 shutil.rmtree(self.tmpdir) |
| 24 os.chdir(self.oldwd) | 24 os.chdir(self.oldwd) |
| 25 | 25 |
| 26 def _load_fixture_and_fetch(self, fixture_name): | 26 def _load_fixture_and_fetch(self, fixture_name, stupid): |
| 27 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, | 27 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, |
| 28 self.wc_path) | 28 self.wc_path, stupid=stupid) |
| 29 | 29 |
| 30 def _debug_print_copies(self, repo): | 30 def _debug_print_copies(self, repo): |
| 31 w = sys.stderr.write | 31 w = sys.stderr.write |
| 32 for rev in repo: | 32 for rev in repo: |
| 33 ctx = repo[rev] | 33 ctx = repo[rev] |
| 34 w('%d - %s\n' % (ctx.rev(), ctx.branch())) | 34 w('%d - %s\n' % (ctx.rev(), ctx.branch())) |
| 35 for f in ctx: | 35 for f in ctx: |
| 36 fctx = ctx[f] | 36 fctx = ctx[f] |
| 37 w('%s: %r %r\n' % (f, fctx.data(), fctx.renamed())) | 37 w('%s: %r %r\n' % (f, fctx.data(), fctx.renamed())) |
| 38 | 38 |
| 39 def test_rename(self): | 39 def _test_rename(self, stupid): |
| 40 repo = self._load_fixture_and_fetch('renames.svndump') | 40 repo = self._load_fixture_and_fetch('renames.svndump', stupid) |
| 41 # self._debug_print_copies(repo) | 41 # self._debug_print_copies(repo) |
| 42 | 42 |
| 43 # Map revnum to mappings of dest name to (source name, dest content) | 43 # Map revnum to mappings of dest name to (source name, dest content) |
| 44 copies = { | 44 copies = { |
| 45 4: { | 45 4: { |
| 69 if not cp: | 69 if not cp: |
| 70 continue | 70 continue |
| 71 self.assertEqual(cp[0], copymap[f][0]) | 71 self.assertEqual(cp[0], copymap[f][0]) |
| 72 self.assertEqual(ctx[f].data(), copymap[f][1]) | 72 self.assertEqual(ctx[f].data(), copymap[f][1]) |
| 73 | 73 |
| 74 def test_rename(self): | |
| 75 self._test_rename(False) | |
| 76 | |
| 77 def test_rename_stupid(self): | |
| 78 self._test_rename(True) | |
| 79 | |
| 74 def suite(): | 80 def suite(): |
| 75 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchRenames), | 81 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchRenames), |
| 76 ] | 82 ] |
| 77 return unittest.TestSuite(all) | 83 return unittest.TestSuite(all) |
