Mercurial > hgsubversion
comparison tests/comprehensive/test_verify_and_startrev.py @ 1106:5cb6c95e0283 stable
Merge default and stable so I can do stable releases again.
| author | Augie Fackler <raf@durin42.com> |
|---|---|
| date | Tue, 11 Feb 2014 12:48:49 -0500 |
| parents | cd0d14e25757 |
| children | ff4e102932ed |
comparison
equal
deleted
inserted
replaced
| 1020:b5b1fce26f1f | 1106:5cb6c95e0283 |
|---|---|
| 35 'correct.svndump', | 35 'correct.svndump', |
| 36 'corrupt.svndump', | 36 'corrupt.svndump', |
| 37 'emptyrepo2.svndump', | 37 'emptyrepo2.svndump', |
| 38 ]) | 38 ]) |
| 39 | 39 |
| 40 def _do_case(self, name, stupid, layout): | 40 def _do_case(self, name, layout): |
| 41 subdir = test_util.subdir.get(name, '') | 41 subdir = test_util.subdir.get(name, '') |
| 42 repo, svnpath = self.load_and_fetch(name, subdir=subdir, stupid=stupid, | 42 config = {} |
| 43 layout=layout) | 43 for branch, path in test_util.custom.get(name, {}).iteritems(): |
| 44 assert len(self.repo) > 0 | 44 config['hgsubversionbranch.%s' % branch] = path |
| 45 repo, svnpath = self.load_and_fetch(name, | |
| 46 subdir=subdir, | |
| 47 layout=layout, | |
| 48 config=config) | |
| 49 assert test_util.repolen(self.repo) > 0 | |
| 45 for i in repo: | 50 for i in repo: |
| 46 ctx = repo[i] | 51 ctx = repo[i] |
| 47 self.assertEqual(verify.verify(repo.ui, repo, rev=ctx.node(), | 52 self.assertEqual(verify.verify(repo.ui, repo, rev=ctx.node(), |
| 48 stupid=True), 0) | 53 stupid=True), 0) |
| 49 self.assertEqual(verify.verify(repo.ui, repo, rev=ctx.node(), | 54 self.assertEqual(verify.verify(repo.ui, repo, rev=ctx.node(), |
| 50 stupid=False), 0) | 55 stupid=False), 0) |
| 51 | 56 |
| 52 # check a startrev clone | 57 # check a startrev clone |
| 53 if layout == 'single' and name not in _skipshallow: | 58 if layout == 'single' and name not in _skipshallow: |
| 54 self.wc_path += '_shallow' | 59 self.wc_path += '_shallow' |
| 55 shallowrepo = self.fetch(svnpath, subdir=subdir, stupid=stupid, | 60 shallowrepo = self.fetch(svnpath, subdir=subdir, |
| 56 layout='single', startrev='HEAD') | 61 layout='single', startrev='HEAD') |
| 57 | 62 |
| 58 self.assertEqual(len(shallowrepo), 1, | 63 self.assertEqual(test_util.repolen(shallowrepo), 1, |
| 59 "shallow clone should have just one revision, not %d" | 64 "shallow clone should have just one revision, not %d" |
| 60 % len(shallowrepo)) | 65 % test_util.repolen(shallowrepo)) |
| 61 | 66 |
| 62 fulltip = repo['tip'] | 67 fulltip = repo['tip'] |
| 63 shallowtip = shallowrepo['tip'] | 68 shallowtip = shallowrepo['tip'] |
| 64 | 69 |
| 65 repo.ui.pushbuffer() | 70 repo.ui.pushbuffer() |
| 83 | 88 |
| 84 for f in fulltip: | 89 for f in fulltip: |
| 85 self.assertMultiLineEqual(fulltip[f].data(), shallowtip[f].data()) | 90 self.assertMultiLineEqual(fulltip[f].data(), shallowtip[f].data()) |
| 86 | 91 |
| 87 | 92 |
| 88 def buildmethod(case, name, stupid, layout): | 93 def buildmethod(case, name, layout): |
| 89 m = lambda self: self._do_case(case, stupid, layout) | 94 m = lambda self: self._do_case(case, layout) |
| 90 m.__name__ = name | 95 m.__name__ = name |
| 91 bits = case, stupid and 'stupid' or 'real', layout | 96 m.__doc__ = 'Test verify on %s (%s)' % (case, layout) |
| 92 m.__doc__ = 'Test verify on %s with %s replay. (%s)' % bits | |
| 93 return m | 97 return m |
| 94 | 98 |
| 95 attrs = {'_do_case': _do_case} | 99 attrs = {'_do_case': _do_case, 'stupid_mode_tests': True} |
| 96 fixtures = [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')] | 100 fixtures = [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')] |
| 97 for case in fixtures: | 101 for case in fixtures: |
| 98 if case in _skipall: | 102 if case in _skipall: |
| 99 continue | 103 continue |
| 100 bname = 'test_' + case[:-len('.svndump')] | 104 bname = 'test_' + case[:-len('.svndump')] |
| 101 if case not in _skipstandard: | 105 if case not in _skipstandard: |
| 102 attrs[bname] = buildmethod(case, bname, False, 'standard') | 106 attrs[bname] = buildmethod(case, bname, 'standard') |
| 103 name = bname + '_stupid' | 107 attrs[bname + '_single'] = buildmethod(case, bname + '_single', 'single') |
| 104 attrs[name] = buildmethod(case, name, True, 'standard') | 108 if case in test_util.custom: |
| 105 name = bname + '_single' | 109 attrs[bname + '_custom'] = buildmethod(case, bname + '_custom', 'custom') |
| 106 attrs[name] = buildmethod(case, name, False, 'single') | |
| 107 # Disabled because the "stupid and real are the same" tests | |
| 108 # verify this plus even more. | |
| 109 # name = bname + '_single_stupid' | |
| 110 # attrs[name] = buildmethod(case, name, True, 'single') | |
| 111 | 110 |
| 112 VerifyTests = type('VerifyTests', (test_util.TestBase,), attrs) | 111 VerifyTests = type('VerifyTests', (test_util.TestBase,), attrs) |
| 113 | |
| 114 def suite(): | |
| 115 all_tests = [unittest.TestLoader().loadTestsFromTestCase(VerifyTests)] | |
| 116 return unittest.TestSuite(all_tests) |
