Dan Villiom Podlaski Christiansen avatar Dan Villiom Podlaski Christiansen committed a5d6812

Better.

Comments (0)

Files changed (7)

 # HG changeset patch
 # User Dan Villiom Podlaski Christiansen  <danchr@gmail.com>
 # Date 1323817677 -3600
-# Node ID 7ac002d36732a3cf80f0f92cea432ef583a19ed5
-# Parent  6b969673ca25c13f47117a9c5a0f4c9c9d9feedd
+# Node ID 9ca11367f3d9db9ac0b1143d61e32736b6e1e795
+# Parent  2d9359a7e345b8233824c45fe7b8f1c2c27c9fa0
 expand configured paths
 
 diff --git a/hgsubversion/svnmeta.py b/hgsubversion/svnmeta.py
 # HG changeset patch
 # User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
 # Date 1323817677 -3600
-# Node ID a2c6380cd301e741d3ad4b2203f5fb7867d439ce
-# Parent  055f9254d790c8972abc96c84a4bae3c454aee8f
+# Node ID 5b3fb9e8c4c5691ce48d75a48060c1a1b1e862aa
+# Parent 30f376d7d3903bef218f2443c72be7b18577dce8
 svnmeta: only remove directory components in normalize()
 
 Previously, a file beginning with the repository subdirectory would be
              path = path[len(self.subdir):]
          if path and path[0] == '/':
              path = path[1:]
-diff --git a/tests/comprehensive/test_verify.py b/tests/comprehensive/test_verify.py
---- a/tests/comprehensive/test_verify.py
-+++ b/tests/comprehensive/test_verify.py
-@@ -31,16 +31,23 @@ def buildmethod(case, name, stupid, layo
-     m.__doc__ = 'Test verify on %s with %s replay. (%s)' % bits
-     return m
+diff --git a/tests/comprehensive/test_verify_and_startrev.py b/tests/comprehensive/test_verify_and_startrev.py
+--- a/tests/comprehensive/test_verify_and_startrev.py
++++ b/tests/comprehensive/test_verify_and_startrev.py
+@@ -23,6 +23,14 @@ from hgsubversion import svncommands
+     'emptyrepo.svndump',
+ ])
  
-+skipall = set([
++_skipall = set([
 +    'project_root_not_repo_root.svndump',
 +])
-+skipstandard = set([
++
++_skipstandard = set([
 +    'subdir_is_file_prefix.svndump',
 +])
 +
+ def _do_case(self, name, stupid, layout):
+     subdir = test_util.subdir.get(name, '')
+     repo = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid, layout=layout)
+@@ -64,13 +72,13 @@ def buildmethod(case, name, stupid, layo
  attrs = {'_do_case': _do_case}
  fixtures = [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]
  for case in fixtures:
 -    # this fixture results in an empty repository, don't use it
 -    if case == 'project_root_not_repo_root.svndump':
-+    if case in skipall:
++    if case in _skipall:
          continue
      bname = 'test_' + case[:-len('.svndump')]
 -    attrs[bname] = buildmethod(case, bname, False, 'standard')
 -    name = bname + '_stupid'
 -    attrs[name] = buildmethod(case, name, True, 'standard')
-+    if case not in skipstandard:
++    if case not in _skipstandard:
 +        attrs[bname] = buildmethod(case, bname, False, 'standard')
 +        name = bname + '_stupid'
 +        attrs[name] = buildmethod(case, name, True, 'standard')

fold-test_startrev.diff

+# HG changeset patch
+# Parent 99a15c6a283c951e7a99008b74a9098736a94379
+# User Dan Villiom Podlaski Christiansen  <danchr@gmail.com>
+fold test_startrev and test_verify into a new test; test_verify_and_startrev
+
+diff --git a/tests/comprehensive/test_verify.py b/tests/comprehensive/test_verify_and_startrev.py
+rename from tests/comprehensive/test_verify.py
+rename to tests/comprehensive/test_verify_and_startrev.py
+--- a/tests/comprehensive/test_verify.py
++++ b/tests/comprehensive/test_verify_and_startrev.py
+@@ -16,14 +16,45 @@ from mercurial import ui
+ 
+ from hgsubversion import svncommands
+ 
++# these fixtures contain no files at HEAD and would result in empty clones
++_skipshallow = set([
++    'binaryfiles.svndump',
++    'binaryfiles-broken.svndump',
++    'emptyrepo.svndump',
++])
++
+ def _do_case(self, name, stupid, layout):
+     subdir = test_util.subdir.get(name, '')
+-    repo = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid, layout=layout)
++    repo, svnpath = self.load_and_fetch(name, subdir=subdir, stupid=stupid,
++                                        layout=layout)
+     assert len(self.repo) > 0
+     for i in repo:
+         ctx = repo[i]
+         self.assertEqual(svncommands.verify(repo.ui, repo, rev=ctx.node()), 0)
+ 
++    # check a startrev clone
++    if layout == 'single' and name not in _skipshallow:
++        self.wc_path += '_shallow'
++        shallowrepo = self.fetch(svnpath, subdir=subdir, stupid=stupid,
++                                 layout='single', startrev='HEAD')
++
++        self.assertEqual(len(shallowrepo), 1,
++                         "shallow clone should have just one revision, not %d"
++                         % len(shallowrepo))
++
++        fulltip = repo['tip']
++        shallowtip = shallowrepo['tip']
++
++        self.assertEqual(0, svncommands.verify(repo.ui, shallowrepo,
++                                               rev=shallowtip.node()))
++
++        # viewing diff's of lists of files is easier on the eyes
++        self.assertMultiLineEqual('\n'.join(fulltip), '\n'.join(shallowtip))
++
++        for f in fulltip:
++            self.assertMultiLineEqual(fulltip[f].data(), shallowtip[f].data())
++
++
+ def buildmethod(case, name, stupid, layout):
+     m = lambda self: self._do_case(case, stupid, layout)
+     m.__name__ = name
+diff --git a/tests/run.py b/tests/run.py
+--- a/tests/run.py
++++ b/tests/run.py
+@@ -25,7 +25,6 @@ def tests():
+     import test_push_eol
+     import test_rebuildmeta
+     import test_single_dir_clone
+-    import test_startrev
+     import test_svnwrap
+     import test_tags
+     import test_template_keywords
+@@ -37,7 +36,7 @@ def tests():
+     sys.path.append(os.path.join(os.path.dirname(__file__), 'comprehensive'))
+ 
+     import test_stupid_pull
+-    import test_verify
++    import test_verify_and_startrev
+ 
+     return locals()
+ 
+diff --git a/tests/test_startrev.py b/tests/test_startrev.py
+deleted file mode 100644
+--- a/tests/test_startrev.py
++++ /dev/null
+@@ -1,71 +0,0 @@
+-import test_util
+-
+-import os
+-import unittest
+-
+-def _do_case(self, name, subdir, stupid):
+-    wc_base = self.wc_path
+-    self.wc_path = wc_base + '_full'
+-    headclone = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid,
+-                                             layout='single', startrev='HEAD')
+-    self.wc_path = wc_base + '_head'
+-    fullclone = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid,
+-                                             layout='single')
+-
+-    fulltip = fullclone['tip']
+-    headtip = headclone['tip']
+-    # viewing diff's of lists of files is easier on the eyes
+-    self.assertMultiLineEqual('\n'.join(fulltip), '\n'.join(headtip))
+-
+-    for f in fulltip:
+-        self.assertMultiLineEqual(fulltip[f].data(), headtip[f].data())
+-
+-    self.assertNotEqual(len(fullclone), 0, "full clone shouldn't be empty")
+-    self.assertEqual(len(headclone), 1,
+-                     "shallow clone should have just one revision, not %d"
+-                     % len(headclone))
+-
+-def buildmethod(case, name, subdir, stupid):
+-    m = lambda self: self._do_case(case, subdir.strip('/'), stupid)
+-    m.__name__ = name
+-    m.__doc__ = ('Test clone with startrev on %s%s with %s replay.' %
+-                 (case, subdir, (stupid and 'stupid') or 'real'))
+-    return m
+-
+-
+-# these fixtures contain no files at HEAD and would result in empty clones
+-nofiles = set([
+-    'binaryfiles.svndump',
+-    'binaryfiles-broken.svndump',
+-    'emptyrepo.svndump',
+-])
+-
+-# these fixtures contain no files in trunk at HEAD and would result in an empty
+-# shallow clone if cloning trunk, so we use another subdirectory
+-subdirmap = {
+-    'commit-to-tag.svndump': '/branches/magic',
+-    'pushexternals.svndump': '',
+-    'tag_name_same_as_branch.svndump': '/branches/magic',
+-}
+-
+-attrs = {'_do_case': _do_case,
+-         }
+-
+-for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]:
+-    if case in nofiles:
+-        continue
+-
+-    subdir = test_util.subdir.get(case, '') + subdirmap.get(case, '/trunk')
+-
+-    bname = 'test_' + case[:-len('.svndump')]
+-    attrs[bname] = buildmethod(case, bname, subdir, False)
+-    name = bname + '_stupid'
+-    attrs[name] = buildmethod(case, name, subdir, True)
+-
+-StartRevTests = type('StartRevTests', (test_util.TestBase,), attrs)
+-
+-
+-def suite():
+-    all_tests = [unittest.TestLoader().loadTestsFromTestCase(StartRevTests),
+-          ]
+-    return unittest.TestSuite(all_tests)
+diff --git a/tests/test_util.py b/tests/test_util.py
+--- a/tests/test_util.py
++++ b/tests/test_util.py
+@@ -297,15 +297,13 @@ class TestBase(unittest.TestCase):
+         proc.communicate()
+         return path
+ 
+-    def load_and_fetch(self, fixture_name, subdir=None, stupid=False,
+-                       layout='auto', startrev=0, externals=None,
+-                       noupdate=True):
++    def fetch(self, repo_path, subdir=None, stupid=False, layout='auto', startrev=0,
++              externals=None, noupdate=True, dest=None):
+         if layout == 'single':
+             if subdir is None:
+                 subdir = 'trunk'
+         elif subdir is None:
+             subdir = ''
+-        repo_path = self.load_svndump(fixture_name)
+         projectpath = repo_path
+         if subdir:
+             projectpath += '/' + subdir
+@@ -326,7 +324,12 @@ class TestBase(unittest.TestCase):
+ 
+         dispatch(cmd)
+ 
+-        return hg.repository(testui(), self.wc_path), repo_path
++        return hg.repository(testui(), self.wc_path)
++
++    def load_and_fetch(self, fixture_name, *args, **opts):
++        repo_path = self.load_svndump(fixture_name)
++
++        return self.fetch(repo_path, *args, **opts), repo_path
+ 
+     def _load_fixture_and_fetch(self, *args, **kwargs):
+         repo, repo_path = self.load_and_fetch(*args, **kwargs)
+# HG changeset patch
+# Parent 998504c51de7a731d3d87641fc22e3f47aa14815
+# User Dan Villiom Podlaski Christiansen  <danchr@gmail.com>
+diff --git a/tests/test_utility_commands.py b/tests/test_utility_commands.py
+--- a/tests/test_utility_commands.py
++++ b/tests/test_utility_commands.py
+@@ -258,7 +258,7 @@ class UtilityTests(test_util.TestBase):
+         output = u.popbuffer()
+         self.assertEqual(1, ret)
+         output = re.sub(r'file://\S+', 'file://', output)
+-        self.assertEqual("""\
++        self.assertMultiLineEqual("""\
+ verifying d51f46a715a1 against file://
+ difference in: binary2
+ unexpected file: binary1
+fold-test_startrev.diff
 fix-prefix.diff
 verify-test.diff
+pretty.diff
 verify-editor.diff
 configpath.diff
 allow-multi-rebuildmeta.diff

verify-editor.diff

 # HG changeset patch
 # User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
 # Date 1323817678 -3600
-# Node ID 6b969673ca25c13f47117a9c5a0f4c9c9d9feedd
-# Parent 413de4b20f5df69230e1e1f39199951a3d0525b0
+# Node ID 2d9359a7e345b8233824c45fe7b8f1c2c27c9fa0
+# Parent 08d443b9849b80b9238d6f31e68c6bbce1172cee
 svn verify: use a custom editor and get_revision()
 
 Previously, we would fetch each file in the revision/changeset
 diff --git a/hgsubversion/editor.py b/hgsubversion/editor.py
 --- a/hgsubversion/editor.py
 +++ b/hgsubversion/editor.py
-@@ -368,3 +368,97 @@ class HgEditor(svnwrap.Editor):
+@@ -368,3 +368,101 @@ class HgEditor(svnwrap.Editor):
                  self._exception_info = sys.exc_info()
                  raise
          return txdelt_window
 +    def __init__(self, ui, ctx):
 +        self.ui = ui
 +        self.ctx = ctx
-+        self.unseen = set(ctx) - util.ignoredfiles
++        self.unexpected = set(ctx) - util.ignoredfiles
++        self.missing = set()
 +        self.failed = False
 +
 +    def open_root(self, base_revnum, pool=None):
 +
 +    def add_file(self, path, parent_baton=None, copyfrom_path=None,
 +                 copyfrom_revision=None, file_pool=None):
-+        try:
-+            self.unseen.remove(path)
++        if path in self.unexpected:
++            self.unexpected.remove(path)
 +            self.file = path
 +            self.props = {}
-+        except KeyError:
-+            self.ui.warn('extra file: %s\n' % path)
++        else:
++            self.missing.add(path)
 +            self.failed = True
 +            self.file = None
 +            self.props = None
 +        raise NotImplementedError()
 +
 +    def apply_textdelta(self, file_baton, base_checksum, pool=None):
-+        stream = cStringIO.StringIO()
++        stream = NeverClosingStringIO()
 +        handler = svnwrap.apply_txdelta('', stream)
 +        if not callable(handler):
 +            raise hgutil.Abort('Error in Subversion bindings: '
 +        raise NotImplementedError()
 +
 +    def check(self):
-+        for f in self.unseen:
++        for f in self.unexpected:
++            self.ui.warn('unexpected file: %s\n' % f)
++            self.failed = True
++        for f in self.missing:
 +            self.ui.warn('missing file: %s\n' % f)
 +            self.failed = True
 +        return not self.failed
 diff --git a/hgsubversion/svncommands.py b/hgsubversion/svncommands.py
 --- a/hgsubversion/svncommands.py
 +++ b/hgsubversion/svncommands.py
-@@ -15,6 +15,7 @@ import svnwrap
+@@ -16,6 +16,7 @@ import svnwrap
  import svnrepo
  import util
  import svnexternals
  
  
  def verify(ui, repo, args=None, **opts):
-@@ -47,39 +48,48 @@ def verify(ui, repo, args=None, **opts):
+@@ -48,42 +49,52 @@ def verify(ui, repo, args=None, **opts):
  
      ui.write('verifying %s against %s@%i\n' % (ctx, branchurl, srev))
  
 -    svnfiles = set()
 -    result = 0
-+    if ui.configbool('hgsubversion', 'stupid'):
++    if opts.get('stupid', ui.configbool('hgsubversion', 'stupid')):
 +        svnfiles = set()
 +        result = 0
  
 -        util.progress(ui, 'verify', i)
 -        if type != 'f':
 -            continue
--        elif fn not in ctx:
--            ui.write('extra file: %s\n' % fn)
--            result = 1
--            continue
 -        svnfiles.add(fn)
 -        fp = fn
 -        if branchpath:
 +            util.progress(ui, 'verify', i)
 +            if type != 'f':
 +                continue
-+            elif fn not in ctx:
-+                ui.write('extra file: %s\n' % fn)
-+                result = 1
-+                continue
 +            svnfiles.add(fn)
 +            fp = fn
 +            if branchpath:
 +                ui.write('wrong flags for: %s\n' % fn)
 +                result = 1
 +
-+        missing = set(ctx) - util.ignoredfiles - svnfiles
-+        for fn in missing:
-+            ui.write('missing file: %s\n' % fn)
++        hgfiles = set(ctx) - util.ignoredfiles
++        if hgfiles != svnfiles:
++            unexpected = hgfiles - svnfiles
++            for f in sorted(unexpected):
++                ui.write('unexpected file: %s\n' % f)
++            missing = svnfiles - hgfiles
++            for f in sorted(missing):
++                ui.write('missing file: %s\n' % f)
              result = 1
  
--    missing = set(ctx) - util.ignoredfiles - svnfiles
--    for fn in missing:
--        ui.write('missing file: %s\n' % fn)
+-    hgfiles = set(ctx) - util.ignoredfiles
+-    if hgfiles != svnfiles:
+-        unexpected = hgfiles - svnfiles
+-        for f in sorted(unexpected):
+-            ui.write('unexpected file: %s\n' % f)
+-        missing = svnfiles - hgfiles
+-        for f in sorted(missing):
+-            ui.write('missing file: %s\n' % f)
 -        result = 1
++        util.progress(ui, 'verify', None)
 +    else:
+ 
+-    util.progress(ui, 'verify', None)
++
 +        v = editor.Verifier(ui, ctx)
 +        svnrepo.svnremoterepo(ui, branchurl).svn.get_revision(srev, v)
 +        if v.check():
  
      return result
  
-diff --git a/tests/comprehensive/test_verify.py b/tests/comprehensive/test_verify.py
---- a/tests/comprehensive/test_verify.py
-+++ b/tests/comprehensive/test_verify.py
-@@ -23,6 +23,9 @@ def _do_case(self, name, stupid, layout)
-     for i in repo:
-         ctx = repo[i]
-         self.assertEqual(svncommands.verify(repo.ui, repo, rev=ctx.node()), 0)
+diff --git a/tests/comprehensive/test_verify_and_startrev.py b/tests/comprehensive/test_verify_and_startrev.py
+--- a/tests/comprehensive/test_verify_and_startrev.py
++++ b/tests/comprehensive/test_verify_and_startrev.py
+@@ -57,6 +57,9 @@ def _do_case(self, name, stupid, layout)
+ 
+         self.assertEqual(0, svncommands.verify(repo.ui, shallowrepo,
+                                                rev=shallowtip.node()))
 +        stupidui = ui.ui(repo.ui)
 +        stupidui.config('hgsubversion', 'stupid', True)
 +        self.assertEqual(svncommands.verify(stupidui, repo, rev=ctx.node()), 0)
  
- def buildmethod(case, name, stupid, layout):
-     m = lambda self: self._do_case(case, stupid, layout)
-@@ -33,10 +36,11 @@ def buildmethod(case, name, stupid, layo
+         # viewing diff's of lists of files is easier on the eyes
+         self.assertMultiLineEqual('\n'.join(fulltip), '\n'.join(shallowtip))
+diff --git a/tests/test_util.py b/tests/test_util.py
+--- a/tests/test_util.py
++++ b/tests/test_util.py
+@@ -237,6 +237,9 @@ class TestBase(unittest.TestCase):
+     def setUp(self):
+         _verify_our_modules()
  
- skipall = set([
-     'project_root_not_repo_root.svndump',
-+    'corrupt.svndump',
- ])
- skipstandard = set([
-     'subdir_is_file_prefix.svndump',
--    'corrupt.svndump',
-+    'correct.svndump',
- ])
++        # prevent Python 2.7 from suppressing large changes
++        self.maxDiff = None
++
+         self.oldenv = dict([(k, os.environ.get(k, None),) for k in
+                            ('LANG', 'LC_ALL', 'HGRCPATH',)])
+         self.oldt = i18n.t
+diff --git a/tests/test_utility_commands.py b/tests/test_utility_commands.py
+--- a/tests/test_utility_commands.py
++++ b/tests/test_utility_commands.py
+@@ -245,16 +245,16 @@ class UtilityTests(test_util.TestBase):
+                                 authors=author_path)
+         self.assertMultiLineEqual(open(author_path).read(), 'Augie=\nevil=\n')
  
- attrs = {'_do_case': _do_case}
-diff --git a/tests/test_corruption.py b/tests/test_corruption.py
---- a/tests/test_corruption.py
-+++ b/tests/test_corruption.py
-@@ -12,14 +12,14 @@ from hgsubversion import svncommands
+-    def test_svnverify(self):
++    def test_svnverify(self, stupid=False):
+         repo, repo_path = self.load_and_fetch('binaryfiles.svndump',
+-                                              noupdate=False)
+-        ret = svncommands.verify(self.ui(), repo, [], rev=1)
++                                              noupdate=False, stupid=stupid)
++        ret = svncommands.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 = svncommands.verify(u, repo, [test_util.fileurl(repo_path)],
+-                                 rev=1)
++                                 rev=1, stupid=stupid)
+         output = u.popbuffer()
+         self.assertEqual(1, ret)
+         output = re.sub(r'file://\S+', 'file://', output)
+@@ -265,16 +265,20 @@ unexpected file: binary1
+ missing file: binary3
+ """, output)
  
- class TestCorruption(test_util.TestBase):
- 
--    def test_verify(self):
-+    def test_verify(self, stupid=False):
+-    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='')
++                                              subdir='', stupid=stupid)
  
--        ui = self.ui()
-+        ui = self.ui(stupid=stupid)
+         ui = self.ui()
  
-         self.assertEqual(SUCCESS, svncommands.verify(ui, self.repo, rev='tip'))
+-        self.assertEqual(SUCCESS, svncommands.verify(ui, self.repo, rev='tip'))
++        self.assertEqual(SUCCESS, svncommands.verify(ui, self.repo, rev='tip',
++                                                     stupid=stupid))
  
-@@ -47,5 +47,8 @@ class TestCorruption(test_util.TestBase)
+         corrupt_source = test_util.fileurl(self.load_svndump('corrupt.svndump'))
+ 
+@@ -300,6 +304,9 @@ missing file: binary3
  
          self.assertEqual((FAILURE, expected), (code, actual))
  
-+    def test_verify_stupid(self):
-+        self.test_verify(True)
++    def test_corruption_stupid(self):
++        self.test_corruption(True)
 +
  def suite():
-     return unittest.TestLoader().loadTestsFromTestCase(TestCorruption)
+     all_tests = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests),
+           ]
 # HG changeset patch
 # User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
 # Date 1323817678 -3600
-# Node ID 0cc046e3b3af81cda55617c59573b9d5b51a27e1
-# Parent  a2c6380cd301e741d3ad4b2203f5fb7867d439ce
+# Node ID 7780f14edecbc1606dc552e08993ca9a31ce0e03
+# Parent 0684f7e0e32610954f0a111bc7c1237f204f03a2
 svn verify: add a test for corrupt repositories.
 
 This case contains a couple of unlikely (but not impossible) failure
 diff --git a/hgsubversion/svncommands.py b/hgsubversion/svncommands.py
 --- a/hgsubversion/svncommands.py
 +++ b/hgsubversion/svncommands.py
-@@ -55,6 +55,10 @@ def verify(ui, repo, args=None, **opts):
-         util.progress(ui, 'verify', i)
-         if type != 'f':
-             continue
-+        elif fn not in ctx:
-+            ui.write('extra file: %s\n' % fn)
-+            result = 1
-+            continue
-         svnfiles.add(fn)
-         fp = fn
-         if branchpath:
-@@ -65,16 +69,16 @@ def verify(ui, repo, args=None, **opts):
+@@ -66,24 +66,21 @@ def verify(ui, repo, args=None, **opts):
          except error.LookupError:
              result = 1
              continue
 +            ui.write('wrong flags for: %s\n' % fn)
              result = 1
  
--    hgfiles = set(ctx) - util.ignoredfiles
--    if hgfiles != svnfiles:
--        missing = set(hgfiles).symmetric_difference(svnfiles)
--        ui.write('missing files: %s\n' % (', '.join(missing)))
-+    missing = set(ctx) - util.ignoredfiles - svnfiles
-+    for fn in missing:
-+        ui.write('missing file: %s\n' % fn)
+     hgfiles = set(ctx) - util.ignoredfiles
+     if hgfiles != svnfiles:
+         unexpected = hgfiles - svnfiles
+-        if unexpected:
+-            ui.write('unexpected files:\n')
+-            for f in sorted(unexpected):
+-                ui.write('  %s\n' % f)
++        for f in sorted(unexpected):
++            ui.write('unexpected file: %s\n' % f)
+         missing = svnfiles - hgfiles
+-        if missing:
+-            ui.write('missing files:\n')
+-            for f in sorted(missing):
+-                ui.write('  %s\n' % f)
++        for f in sorted(missing):
++            ui.write('missing file: %s\n' % f)
          result = 1
  
-     return result
+     util.progress(ui, 'verify', None)
 diff --git a/tests/comprehensive/test_stupid_pull.py b/tests/comprehensive/test_stupid_pull.py
 --- a/tests/comprehensive/test_stupid_pull.py
 +++ b/tests/comprehensive/test_stupid_pull.py
      name = 'test_' + case[:-len('.svndump')]
      # Automatic layout branchtag collision exposes a minor defect
      # here, but since it isn't a regression we suppress the test case.
-diff --git a/tests/comprehensive/test_verify.py b/tests/comprehensive/test_verify.py
---- a/tests/comprehensive/test_verify.py
-+++ b/tests/comprehensive/test_verify.py
-@@ -36,6 +36,7 @@ skipall = set([
+diff --git a/tests/comprehensive/test_verify_and_startrev.py b/tests/comprehensive/test_verify_and_startrev.py
+--- a/tests/comprehensive/test_verify_and_startrev.py
++++ b/tests/comprehensive/test_verify_and_startrev.py
+@@ -21,6 +21,8 @@ from hgsubversion import svncommands
+     'binaryfiles.svndump',
+     'binaryfiles-broken.svndump',
+     'emptyrepo.svndump',
++    'correct.svndump',
++    'corrupt.svndump',
  ])
- skipstandard = set([
+ 
+ _skipall = set([
+@@ -29,6 +31,7 @@ from hgsubversion import svncommands
+ 
+ _skipstandard = set([
      'subdir_is_file_prefix.svndump',
 +    'corrupt.svndump',
  ])
  
- attrs = {'_do_case': _do_case}
+ def _do_case(self, name, stupid, layout):
 diff --git a/tests/fixtures/correct.svndump b/tests/fixtures/correct.svndump
 new file mode 100644
 --- /dev/null
 +2010-11-30T15:16:01.077550Z
 +PROPS-END
 +
-+Node-path: extra-file
++Node-path: missing-file
 +Node-kind: file
 +Node-action: add
 +Prop-content-length: 10
 +Content-length: 0
 +
 +
-diff --git a/tests/run.py b/tests/run.py
---- a/tests/run.py
-+++ b/tests/run.py
-@@ -8,6 +8,7 @@ test_util.SkipTest = None
+diff --git a/tests/test_rebuildmeta.py b/tests/test_rebuildmeta.py
+--- a/tests/test_rebuildmeta.py
++++ b/tests/test_rebuildmeta.py
+@@ -101,11 +101,16 @@ def buildmethod(case, name, stupid, sing
+     return m
  
- def tests():
-     import test_binaryfiles
-+    import test_corruption
-     import test_diff
-     import test_externals
-     import test_fetch_branches
-diff --git a/tests/test_corruption.py b/tests/test_corruption.py
-new file mode 100644
---- /dev/null
-+++ b/tests/test_corruption.py
-@@ -0,0 +1,51 @@
-+import test_util
+ 
++skip = set([
++    'project_root_not_repo_root.svndump',
++    'corrupt.svndump',
++])
 +
-+import os, sys, cStringIO, difflib
-+import unittest
-+
-+from mercurial import commands
-+from mercurial import hg
-+from mercurial import node
-+from mercurial import ui
-+
-+from hgsubversion import svncommands
-+
-+class TestCorruption(test_util.TestBase):
-+
-+    def test_verify(self):
+ attrs = {'_do_case': _do_case,
+          }
+ for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]:
+     # this fixture results in an empty repository, don't use it
+-    if case == 'project_root_not_repo_root.svndump':
++    if case in skip:
+         continue
+     bname = 'test_' + case[:-len('.svndump')]
+     attrs[bname] = buildmethod(case, bname, False, False)
+diff --git a/tests/test_utility_commands.py b/tests/test_utility_commands.py
+--- a/tests/test_utility_commands.py
++++ b/tests/test_utility_commands.py
+@@ -260,13 +260,46 @@ class UtilityTests(test_util.TestBase):
+         output = re.sub(r'file://\S+', 'file://', output)
+         self.assertEqual("""\
+ verifying d51f46a715a1 against file://
+-difference in file binary2
+-unexpected files:
+-  binary1
+-missing files:
+-  binary3
++difference in: binary2
++unexpected file: binary1
++missing file: binary3
+ """, output)
+ 
++    def test_svnverify_corruption(self):
 +        SUCCESS = 0
 +        FAILURE = 1
 +
 +
 +        expected = set([
 +            'verifying 78e965230a13 against $REPO@1',
-+            'extra file: extra-file',
++            'missing file: missing-file',
 +            'wrong flags for: executable-file',
 +            'wrong flags for: symlink',
 +            'wrong flags for: regular-file',
 +            'difference in: another-regular-file',
 +            'difference in: regular-file',
-+            'missing file: empty-file',
++            'unexpected file: empty-file',
 +        ])
 +
 +        self.assertEqual((FAILURE, expected), (code, actual))
 +
-+def suite():
-+    return unittest.TestLoader().loadTestsFromTestCase(TestCorruption)
-diff --git a/tests/test_rebuildmeta.py b/tests/test_rebuildmeta.py
---- a/tests/test_rebuildmeta.py
-+++ b/tests/test_rebuildmeta.py
-@@ -101,11 +101,16 @@ def buildmethod(case, name, stupid, sing
-     return m
- 
- 
-+skip = set([
-+    'project_root_not_repo_root.svndump',
-+    'corrupt.svndump',
-+])
-+
- attrs = {'_do_case': _do_case,
-          }
- for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]:
-     # this fixture results in an empty repository, don't use it
--    if case == 'project_root_not_repo_root.svndump':
-+    if case in skip:
-         continue
-     bname = 'test_' + case[:-len('.svndump')]
-     attrs[bname] = buildmethod(case, bname, False, False)
-diff --git a/tests/test_startrev.py b/tests/test_startrev.py
---- a/tests/test_startrev.py
-+++ b/tests/test_startrev.py
-@@ -37,6 +37,8 @@ def buildmethod(case, name, subdir, stup
- nofiles = set([
-     'binaryfiles.svndump',
-     'emptyrepo.svndump',
-+    'correct.svndump',
-+    'corrupt.svndump',
- ])
- 
- # these fixtures contain no files in trunk at HEAD and would result in an empty
-@@ -45,6 +47,7 @@ subdirmap = {
-     'commit-to-tag.svndump': '/branches/magic',
-     'pushexternals.svndump': '',
-     'tag_name_same_as_branch.svndump': '/branches/magic',
-+    'subdir_is_file_prefix.svndump': '',
- }
- 
- attrs = {'_do_case': _do_case,
+ def suite():
+     all_tests = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests),
+           ]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.