Mercurial > hgsubversion
comparison tests/test_rebuildmeta.py @ 821:f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
This prevents re-pulling the same revision over and over, which was a
problem when the most recent revision was a tagging revision that
wouldn't exist properly in the revmap. This should also allow users to
not re-pull huge volumes of commits that have no effect on the hg
repository.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Tue, 24 May 2011 21:07:27 -0500 |
parents | 86d124a8768e |
children | e9af7eba88db |
comparison
equal
deleted
inserted
replaced
820:09f7c1c09207 | 821:f28e0f54a6ef |
---|---|
9 from mercurial import hg | 9 from mercurial import hg |
10 from mercurial import ui | 10 from mercurial import ui |
11 | 11 |
12 from hgsubversion import svncommands | 12 from hgsubversion import svncommands |
13 from hgsubversion import svnmeta | 13 from hgsubversion import svnmeta |
14 | |
15 # These test repositories have harmless skew in rebuildmeta for the | |
16 # last-pulled-rev because the last rev in svn causes absolutely no | |
17 # changes in hg. | |
18 expect_youngest_skew = [('file_mixed_with_branches.svndump', False, False), | |
19 ('file_mixed_with_branches.svndump', True, False), | |
20 ('unrelatedbranch.svndump', False, False), | |
21 ('unrelatedbranch.svndump', True, False), | |
22 ] | |
23 | |
24 | |
14 | 25 |
15 def _do_case(self, name, stupid, single): | 26 def _do_case(self, name, stupid, single): |
16 subdir = test_util.subdir.get(name, '') | 27 subdir = test_util.subdir.get(name, '') |
17 layout = 'auto' | 28 layout = 'auto' |
18 if single: | 29 if single: |
42 self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')), | 53 self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')), |
43 'no .hg/svn directory in the source!') | 54 'no .hg/svn directory in the source!') |
44 self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')), | 55 self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')), |
45 'no .hg/svn directory in the destination!') | 56 'no .hg/svn directory in the destination!') |
46 dest = hg.repository(u, os.path.dirname(dest.path)) | 57 dest = hg.repository(u, os.path.dirname(dest.path)) |
47 for tf in ('rev_map', 'uuid', 'tagmap', 'layout', 'subdir', ): | 58 for tf in ('lastpulled', 'rev_map', 'uuid', 'tagmap', 'layout', 'subdir', ): |
59 | |
48 stf = os.path.join(src.path, 'svn', tf) | 60 stf = os.path.join(src.path, 'svn', tf) |
49 self.assertTrue(os.path.isfile(stf), '%r is missing!' % stf) | 61 self.assertTrue(os.path.isfile(stf), '%r is missing!' % stf) |
50 dtf = os.path.join(dest.path, 'svn', tf) | 62 dtf = os.path.join(dest.path, 'svn', tf) |
51 self.assertTrue(os.path.isfile(dtf), '%r is missing!' % tf) | 63 self.assertTrue(os.path.isfile(dtf), '%r is missing!' % tf) |
52 old, new = open(stf).read(), open(dtf).read() | 64 old, new = open(stf).read(), open(dtf).read() |
65 if tf == 'lastpulled' and (name, | |
66 stupid, single) in expect_youngest_skew: | |
67 self.assertNotEqual(old, new, | |
68 'rebuildmeta unexpected match on youngest rev!') | |
69 continue | |
53 self.assertMultiLineEqual(old, new) | 70 self.assertMultiLineEqual(old, new) |
54 self.assertEqual(src.branchtags(), dest.branchtags()) | 71 self.assertEqual(src.branchtags(), dest.branchtags()) |
55 srcbi = pickle.load(open(os.path.join(src.path, 'svn', 'branch_info'))) | 72 srcbi = pickle.load(open(os.path.join(src.path, 'svn', 'branch_info'))) |
56 destbi = pickle.load(open(os.path.join(dest.path, 'svn', 'branch_info'))) | 73 destbi = pickle.load(open(os.path.join(dest.path, 'svn', 'branch_info'))) |
57 self.assertEqual(sorted(srcbi.keys()), sorted(destbi.keys())) | 74 self.assertEqual(sorted(srcbi.keys()), sorted(destbi.keys())) |