comparison tests/test_utility_commands.py @ 897:6bc8046e3d0a

move verify to a file of its own
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sun, 13 May 2012 15:36:45 +0200
parents 3bfb7e985c47
children 7f90bb48c9de
comparison
equal deleted inserted replaced
896:04dfc23688b9 897:6bc8046e3d0a
12 from mercurial import commands 12 from mercurial import commands
13 from mercurial import util as hgutil 13 from mercurial import util as hgutil
14 14
15 from hgsubversion import util 15 from hgsubversion import util
16 from hgsubversion import svncommands 16 from hgsubversion import svncommands
17 from hgsubversion import verify
17 from hgsubversion import wrappers 18 from hgsubversion import wrappers
18 19
19 expected_info_output = '''URL: %(repourl)s/%(branch)s 20 expected_info_output = '''URL: %(repourl)s/%(branch)s
20 Repository Root: %(repourl)s 21 Repository Root: %(repourl)s
21 Repository UUID: df2126f7-00ab-4d49-b42c-7e981dde0bcf 22 Repository UUID: df2126f7-00ab-4d49-b42c-7e981dde0bcf
246 self.assertMultiLineEqual(open(author_path).read(), 'Augie=\nevil=\n') 247 self.assertMultiLineEqual(open(author_path).read(), 'Augie=\nevil=\n')
247 248
248 def test_svnverify(self): 249 def test_svnverify(self):
249 repo, repo_path = self.load_and_fetch('binaryfiles.svndump', 250 repo, repo_path = self.load_and_fetch('binaryfiles.svndump',
250 noupdate=False) 251 noupdate=False)
251 ret = svncommands.verify(self.ui(), repo, [], rev=1) 252 ret = verify.verify(self.ui(), repo, [], rev=1)
252 self.assertEqual(0, ret) 253 self.assertEqual(0, ret)
253 repo_path = self.load_svndump('binaryfiles-broken.svndump') 254 repo_path = self.load_svndump('binaryfiles-broken.svndump')
254 u = self.ui() 255 u = self.ui()
255 u.pushbuffer() 256 u.pushbuffer()
256 ret = svncommands.verify(u, repo, [test_util.fileurl(repo_path)], 257 ret = verify.verify(u, repo, [test_util.fileurl(repo_path)], rev=1)
257 rev=1)
258 output = u.popbuffer() 258 output = u.popbuffer()
259 self.assertEqual(1, ret) 259 self.assertEqual(1, ret)
260 output = re.sub(r'file://\S+', 'file://', output) 260 output = re.sub(r'file://\S+', 'file://', output)
261 self.assertMultiLineEqual("""\ 261 self.assertMultiLineEqual("""\
262 verifying d51f46a715a1 against file:// 262 verifying d51f46a715a1 against file://
272 repo, repo_path = self.load_and_fetch('correct.svndump', layout='single', 272 repo, repo_path = self.load_and_fetch('correct.svndump', layout='single',
273 subdir='') 273 subdir='')
274 274
275 ui = self.ui() 275 ui = self.ui()
276 276
277 self.assertEqual(SUCCESS, svncommands.verify(ui, self.repo, rev='tip')) 277 self.assertEqual(SUCCESS, verify.verify(ui, self.repo, rev='tip'))
278 278
279 corrupt_source = test_util.fileurl(self.load_svndump('corrupt.svndump')) 279 corrupt_source = test_util.fileurl(self.load_svndump('corrupt.svndump'))
280 280
281 repo.ui.setconfig('paths', 'default', corrupt_source) 281 repo.ui.setconfig('paths', 'default', corrupt_source)
282 282
283 ui.pushbuffer() 283 ui.pushbuffer()
284 code = svncommands.verify(ui, repo, rev='tip') 284 code = verify.verify(ui, repo, rev='tip')
285 actual = ui.popbuffer() 285 actual = ui.popbuffer()
286 286
287 actual = actual.replace(corrupt_source, '$REPO') 287 actual = actual.replace(corrupt_source, '$REPO')
288 actual = set(actual.splitlines()) 288 actual = set(actual.splitlines())
289 289