changeset 880:d4312a6f7a87

test_utility_commands: test verify command Also, make verify output more stable.
author Patrick Mezard <patrick@mezard.eu>
date Sat, 21 Apr 2012 11:36:23 +0200
parents 055f9254d790
children ce5837c64b12
files hgsubversion/svncommands.py tests/fixtures/binaryfiles-broken.svndump tests/test_startrev.py tests/test_utility_commands.py
diffstat 4 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svncommands.py
+++ b/hgsubversion/svncommands.py
@@ -74,7 +74,7 @@ def verify(ui, repo, args=None, **opts):
     hgfiles = set(ctx) - util.ignoredfiles
     if hgfiles != svnfiles:
         missing = set(hgfiles).symmetric_difference(svnfiles)
-        ui.write('missing files: %s\n' % (', '.join(missing)))
+        ui.write('missing files: %s\n' % (', '.join(sorted(missing))))
         result = 1
 
     return result
new file mode 100644
index 0000000000000000000000000000000000000000..08863e0c138559872e81318200501557cdea22c0
GIT binary patch
literal 1835
zc$}?NNp9OP6xEui&;{sl6h&>DE{X!Kk!jH#hc8==HGrm#rl&8hAb<nesT+H#M@nym
z?w{tk-eA9N2VD1|H4*P1Y?{8Sa)!|3<G0%?7q;Y1u@XyOFf6p;*p!OlT63X6Q(f03
zLU*uh_AlaY+gb=!PS7Is19p8Ep^JD8-7>DKTo&ld6hhzg5^Z)}<xK?ilrx1GAtj~^
zGyOnSMT&~a8Reo7;wM_%{aD=Nuk+g@y!1FPrD8(7#}cy|nb-X?5mSbmu8H{&`d{E;
zI;CVhHru%BL%N~R(83=R{JEO7W?a3~Jnuc=!R#f(u<f2-f#;_4RqmVc`e<AndobRg
za73nt2s-4MhQlrmC#lJ8)0xn~=HhUQ85bnMABJ-?(!KD*km_a)XQm`IdVt??f~)s%
z>t(WBYRL>ps|6*rwvub@m?4S^2|~F^M#Z>X%15Vd(*lk!!)R9^GYsp-nZ3N5-bILb
z69bs`z^lnJWHWoxGyA0H)XLeOxnfExLWHE;2u~?5Ys-><?zQ(;PIsXWH)fLsm-!=8
z<EN&kj!aEWrY4bFnQjT!Tbr6O!6?yJSlg?#^FtO!m4(t;5D?O9=LoN*VAePQOPHP{
zlJYQb$$oAeA4x1HeCY?Cn#_>T>LXQ(OREgf_PZ-qS*E{g!3+5xRleooVGZfS|B7{T
F{V!|dG7<m)
--- a/tests/test_startrev.py
+++ b/tests/test_startrev.py
@@ -36,6 +36,7 @@ def buildmethod(case, name, subdir, stup
 # these fixtures contain no files at HEAD and would result in empty clones
 nofiles = set([
     'binaryfiles.svndump',
+    'binaryfiles-broken.svndump',
     'emptyrepo.svndump',
 ])
 
--- a/tests/test_utility_commands.py
+++ b/tests/test_utility_commands.py
@@ -2,6 +2,7 @@ import test_util
 
 import os
 import unittest
+import re
 
 from hgext import rebase
 from mercurial import hg
@@ -244,6 +245,24 @@ class UtilityTests(test_util.TestBase):
                                 authors=author_path)
         self.assertMultiLineEqual(open(author_path).read(), 'Augie=\nevil=\n')
 
+    def test_svnverify(self):
+        repo, repo_path = self.load_and_fetch('binaryfiles.svndump',
+                                              noupdate=False)
+        ret = svncommands.verify(self.ui(), repo, [], rev=1)
+        self.assertEqual(0, ret)
+        repo_path = self.load_svndump('binaryfiles-broken.svndump')
+        u = self.ui()
+        u.pushbuffer()
+        ret = svncommands.verify(u, repo, [test_util.fileurl(repo_path)],
+                                 rev=1)
+        output = u.popbuffer()
+        self.assertEqual(1, ret)
+        output = re.sub(r'file://\S+', 'file://', output)
+        self.assertEqual("""\
+verifying d51f46a715a1 against file://
+difference in file binary2
+missing files: binary1, binary3
+""", output)
 
 def suite():
     all_tests = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests),