comparison tests/test_rebuildmeta.py @ 447:0d3b5acb1d51

tags: handle edits to tags as gracefully as possible
author Augie Fackler <durin42@gmail.com>
date Tue, 23 Jun 2009 21:38:27 -0500
parents cd6317fe70be
children fbc7cf4fd701
comparison
equal deleted inserted replaced
446:cbd230043379 447:0d3b5acb1d51
30 for tf in ('rev_map', 'uuid'): 30 for tf in ('rev_map', 'uuid'):
31 stf = os.path.join(src.path, 'svn', tf) 31 stf = os.path.join(src.path, 'svn', tf)
32 self.assertTrue(os.path.isfile(stf), '%r is missing!' % stf) 32 self.assertTrue(os.path.isfile(stf), '%r is missing!' % stf)
33 dtf = os.path.join(dest.path, 'svn', tf) 33 dtf = os.path.join(dest.path, 'svn', tf)
34 self.assertTrue(os.path.isfile(dtf), '%r is missing!' % tf) 34 self.assertTrue(os.path.isfile(dtf), '%r is missing!' % tf)
35 self.assertEqual(open(stf).read(), 35 old, new = open(stf).read(), open(dtf).read()
36 open(dtf).read()) 36 self.assertEqual(old, new)
37 self.assertEqual(src.branchtags(), dest.branchtags()) 37 self.assertEqual(src.branchtags(), dest.branchtags())
38 srcbi = pickle.load(open(os.path.join(src.path, 'svn', 'branch_info'))) 38 srcbi = pickle.load(open(os.path.join(src.path, 'svn', 'branch_info')))
39 destbi = pickle.load(open(os.path.join(dest.path, 'svn', 'branch_info'))) 39 destbi = pickle.load(open(os.path.join(dest.path, 'svn', 'branch_info')))
40 self.assertEqual(sorted(srcbi.keys()), sorted(destbi.keys())) 40 self.assertEqual(sorted(srcbi.keys()), sorted(destbi.keys()))
41 revkeys = svnmeta.SVNMeta(dest).revmap.keys() 41 revkeys = svnmeta.SVNMeta(dest).revmap.keys()
42 for branch in destbi: 42 for branch in destbi:
43 srcinfo = srcbi[branch] 43 srcinfo = srcbi[branch]
44 destinfo = destbi[branch] 44 destinfo = destbi[branch]
45 if destinfo[:2] == (None, 0): 45 if srcinfo[:2] == (None, 0) or destinfo[:2] == (None, 0):
46 self.assert_(srcinfo[2] <= destinfo[2]) 46 self.assert_(srcinfo[2] <= destinfo[2])
47 self.assertEqual(srcinfo[0], destinfo[0]) 47 self.assertEqual(srcinfo[0], destinfo[0])
48 else: 48 else:
49 pr = sorted(filter(lambda x: x[1] == srcinfo[0] and x[0] <= srcinfo[1], 49 pr = sorted(filter(lambda x: x[1] == srcinfo[0] and x[0] <= srcinfo[1],
50 revkeys), reverse=True)[0][0] 50 revkeys), reverse=True)[0][0]