comparison tests/test_rebuildmeta.py @ 893:295a8b48e4e2

Merge
author Augie Fackler <raf@durin42.com>
date Sat, 12 May 2012 10:07:29 -0500
parents 3bfb7e985c47 78db88de9622
children 7e9d805a0e1f
comparison
equal deleted inserted replaced
892:3bfb7e985c47 893:295a8b48e4e2
49 subdir), ]) 49 subdir), ])
50 finally: 50 finally:
51 # remove the wrapper 51 # remove the wrapper
52 context.changectx.children = origchildren 52 context.changectx.children = origchildren
53 53
54 self._run_assertions(name, stupid, single, src, dest, u)
55
56 wc3_path = self.wc_path + '_partial'
57 src, dest = test_util.hgclone(u,
58 self.wc_path,
59 wc3_path,
60 update=False,
61 rev=[0])
62
63 # insert a wrapper that prevents calling changectx.children()
64 extensions.wrapfunction(context.changectx, 'children', failfn)
65
66 try:
67 svncommands.rebuildmeta(u, dest,
68 args=[test_util.fileurl(repo_path +
69 subdir), ])
70 finally:
71 # remove the wrapper
72 context.changectx.children = origchildren
73
74 dest.pull(src)
75
76 # insert a wrapper that prevents calling changectx.children()
77 extensions.wrapfunction(context.changectx, 'children', failfn)
78 try:
79 svncommands.updatemeta(u, dest,
80 args=[test_util.fileurl(repo_path +
81 subdir), ])
82 finally:
83 # remove the wrapper
84 context.changectx.children = origchildren
85
86 self._run_assertions(name, stupid, single, src, dest, u)
87
88
89 def _run_assertions(self, name, stupid, single, src, dest, u):
90
54 self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')), 91 self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')),
55 'no .hg/svn directory in the source!') 92 'no .hg/svn directory in the source!')
56 self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')), 93 self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')),
57 'no .hg/svn directory in the destination!') 94 'no .hg/svn directory in the destination!')
58 dest = hg.repository(u, os.path.dirname(dest.path)) 95 dest = hg.repository(u, os.path.dirname(dest.path))
66 if tf == 'lastpulled' and (name, 103 if tf == 'lastpulled' and (name,
67 stupid, single) in expect_youngest_skew: 104 stupid, single) in expect_youngest_skew:
68 self.assertNotEqual(old, new, 105 self.assertNotEqual(old, new,
69 'rebuildmeta unexpected match on youngest rev!') 106 'rebuildmeta unexpected match on youngest rev!')
70 continue 107 continue
71 self.assertMultiLineEqual(old, new) 108 self.assertMultiLineEqual(old, new, tf + ' differs')
72 self.assertEqual(src.branchtags(), dest.branchtags()) 109 self.assertEqual(src.branchtags(), dest.branchtags())
73 srcbi = pickle.load(open(os.path.join(src.path, 'svn', 'branch_info'))) 110 srcbi = pickle.load(open(os.path.join(src.path, 'svn', 'branch_info')))
74 destbi = pickle.load(open(os.path.join(dest.path, 'svn', 'branch_info'))) 111 destbi = pickle.load(open(os.path.join(dest.path, 'svn', 'branch_info')))
75 self.assertEqual(sorted(srcbi.keys()), sorted(destbi.keys())) 112 self.assertEqual(sorted(srcbi.keys()), sorted(destbi.keys()))
76 revkeys = svnmeta.SVNMeta(dest).revmap.keys() 113 revkeys = svnmeta.SVNMeta(dest).revmap.keys()
105 'project_root_not_repo_root.svndump', 142 'project_root_not_repo_root.svndump',
106 'corrupt.svndump', 143 'corrupt.svndump',
107 ]) 144 ])
108 145
109 attrs = {'_do_case': _do_case, 146 attrs = {'_do_case': _do_case,
147 '_run_assertions': _run_assertions,
110 } 148 }
111 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]: 149 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]:
112 # this fixture results in an empty repository, don't use it 150 # this fixture results in an empty repository, don't use it
113 if case in skip: 151 if case in skip:
114 continue 152 continue