Mercurial > hgsubversion
diff tests/test_utility_commands.py @ 899:7f90bb48c9de
svn verify: use a custom editor and get_revision()
Previously, we would fetch each file in the revision/changeset
individually. With this change, we fetch the entire revision in one
request, and use a custom editor to verify its contents. This is quite
a lot faster than the previous means when verifying over the internet.
By an order of magnitude or two, in fact. As data is transfered in a
single operation, verifying a revision from PyPy took 30 seconds
rather than 30 minutes, and saturated my 10Mbps connection.
Please note that the output ordering isn't stable between the two;
output will appear in reverse order when using the fast verifier.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Wed, 14 Dec 2011 00:07:58 +0100 |
parents | 6bc8046e3d0a |
children | 761a87134501 |
line wrap: on
line diff
--- a/tests/test_utility_commands.py +++ b/tests/test_utility_commands.py @@ -246,15 +246,16 @@ class UtilityTests(test_util.TestBase): authors=author_path) self.assertMultiLineEqual(open(author_path).read(), 'Augie=\nevil=\n') - def test_svnverify(self): + def test_svnverify(self, stupid=False): repo, repo_path = self.load_and_fetch('binaryfiles.svndump', - noupdate=False) - ret = verify.verify(self.ui(), repo, [], rev=1) + noupdate=False, stupid=stupid) + ret = verify.verify(self.ui(), repo, [], rev=1, stupid=stupid) self.assertEqual(0, ret) repo_path = self.load_svndump('binaryfiles-broken.svndump') u = self.ui() u.pushbuffer() - ret = verify.verify(u, repo, [test_util.fileurl(repo_path)], rev=1) + ret = verify.verify(u, repo, [test_util.fileurl(repo_path)], + rev=1, stupid=stupid) output = u.popbuffer() self.assertEqual(1, ret) output = re.sub(r'file://\S+', 'file://', output) @@ -265,16 +266,20 @@ unexpected file: binary1 missing file: binary3 """, output) - def test_svnverify_corruption(self): + def test_svnverify_stupid(self): + self.test_svnverify(True) + + def test_corruption(self, stupid=False): SUCCESS = 0 FAILURE = 1 repo, repo_path = self.load_and_fetch('correct.svndump', layout='single', - subdir='') + subdir='', stupid=stupid) ui = self.ui() - self.assertEqual(SUCCESS, verify.verify(ui, self.repo, rev='tip')) + self.assertEqual(SUCCESS, verify.verify(ui, self.repo, rev='tip', + stupid=stupid)) corrupt_source = test_util.fileurl(self.load_svndump('corrupt.svndump')) @@ -300,6 +305,9 @@ missing file: binary3 self.assertEqual((FAILURE, expected), (code, actual)) + def test_corruption_stupid(self): + self.test_corruption(True) + def suite(): all_tests = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests), ]