changeset 1046:36fe4b316a6b

stupid: fix --startrev we didn't test for this, so it was broken...
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Wed, 07 Aug 2013 22:42:11 +0200
parents 67e11b650e94
children 3092b3c109a8
files hgsubversion/stupid.py tests/comprehensive/test_verify_and_startrev.py
diffstat 2 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/stupid.py
+++ b/hgsubversion/stupid.py
@@ -606,12 +606,18 @@ def checkbranch(meta, r, branch):
             return None
     return branchtip
 
-def branches_in_paths(meta, tbdelta, paths, revnum, checkpath, listdir):
+def branches_in_paths(meta, tbdelta, paths, revnum, checkpath, listdir,
+                      firstrun):
     '''Given a list of paths, return mapping of all branches touched
     to their branch path.
     '''
     branches = {}
-    paths_need_discovery = []
+    if firstrun:
+        paths_need_discovery = [p for (p, t) in listdir('', revnum)
+                                if t == 'f']
+    else:
+        paths_need_discovery = []
+
     for p in paths:
         relpath, branch, branchpath = meta.split_branch_path(p)
         if relpath is not None:
@@ -671,7 +677,7 @@ def convert_rev(ui, meta, svn, r, tbdelt
         raise hgutil.Abort('filemaps currently unsupported with stupid replay.')
 
     branches = branches_in_paths(meta, tbdelta, r.paths, r.revnum,
-                                 svn.checkpath, svn.list_files)
+                                 svn.checkpath, svn.list_files, firstrun)
     brpaths = branches.values()
     bad_branch_paths = {}
     for br, bp in branches.iteritems():
@@ -735,7 +741,8 @@ def convert_rev(ui, meta, svn, r, tbdelt
         # it, or we can force the existing fetch_branchrev() path. Do
         # the latter for now.
         incremental = (meta.revmap.oldest > 0 and
-                       parentctx.rev() != node.nullrev)
+                       parentctx.rev() != node.nullrev and
+                       not firstrun)
 
         if incremental:
             try:
--- a/tests/comprehensive/test_verify_and_startrev.py
+++ b/tests/comprehensive/test_verify_and_startrev.py
@@ -104,9 +104,7 @@ for case in fixtures:
         attrs[name] = buildmethod(case, name, True, 'standard')
     name = bname + '_single'
     attrs[name] = buildmethod(case, name, False, 'single')
-    # Disabled because the "stupid and real are the same" tests
-    # verify this plus even more.
-    # name = bname + '_single_stupid'
-    # attrs[name] = buildmethod(case, name, True, 'single')
+    name = bname + '_single_stupid'
+    attrs[name] = buildmethod(case, name, True, 'single')
 
 VerifyTests = type('VerifyTests', (test_util.TestBase,), attrs)