comparison tests/test_rebuildmeta.py @ 194:13ae1bded5e7

Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
author Augie Fackler <durin42@gmail.com>
date Wed, 21 Jan 2009 20:27:51 -0600
parents 47d25d61abfa
children 125cf3cb7bee
comparison
equal deleted inserted replaced
193:6e3f99ba47ec 194:13ae1bded5e7
7 7
8 import test_util 8 import test_util
9 import rebuildmeta 9 import rebuildmeta
10 import hg_delta_editor 10 import hg_delta_editor
11 11
12 subdir = {'truncatedhistory.svndump': '/project2',
13 'fetch_missing_files_subdir.svndump': '/foo',
14 }
15 # List of expected "missing" branches - these are really files that happen 12 # List of expected "missing" branches - these are really files that happen
16 # to be in the branches dir. This will be fixed at a later date. 13 # to be in the branches dir. This will be fixed at a later date.
17 expected_branch_deltas = {'unrelatedbranch.svndump': ['c', ], 14 expected_branch_deltas = {'unrelatedbranch.svndump': ['c', ],
18 'file_mixed_with_branches.svndump': ['README', ], 15 'file_mixed_with_branches.svndump': ['README', ],
19 } 16 }
20 17
21 def _do_case(self, name, stupid): 18 def _do_case(self, name, stupid):
22 self._load_fixture_and_fetch(name, subdir=subdir.get(name, ''), stupid=stupid) 19 subdir = test_util.subdir.get(name, '')
20 self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid)
23 assert len(self.repo) > 0 21 assert len(self.repo) > 0
24 wc2_path = self.wc_path + '_clone' 22 wc2_path = self.wc_path + '_clone'
25 u = ui.ui() 23 u = ui.ui()
26 src, dest = hg.clone(u, self.wc_path, wc2_path, update=False) 24 src, dest = hg.clone(u, self.wc_path, wc2_path, update=False)
27 rebuildmeta.rebuildmeta(u, 25 rebuildmeta.rebuildmeta(u,
28 dest, 26 dest,
29 os.path.dirname(dest.path), 27 os.path.dirname(dest.path),
30 args=[test_util.fileurl(self.repo_path + 28 args=[test_util.fileurl(self.repo_path +
31 subdir.get(name, '')), ]) 29 subdir), ])
32 dest = hg.repository(u, os.path.dirname(dest.path)) 30 dest = hg.repository(u, os.path.dirname(dest.path))
33 self.assert_(open(os.path.join(src.path, 'svn', 'last_rev')).read() >= 31 self.assert_(open(os.path.join(src.path, 'svn', 'last_rev')).read() >=
34 open(os.path.join(dest.path, 'svn', 'last_rev')).read()) 32 open(os.path.join(dest.path, 'svn', 'last_rev')).read())
35 for tf in ('rev_map', 'uuid', 'url'): 33 for tf in ('rev_map', 'uuid', 'url'):
36 self.assertEqual(open(os.path.join(src.path, 'svn', tf)).read(), 34 self.assertEqual(open(os.path.join(src.path, 'svn', tf)).read(),