changeset 657:9cf547fc36e8

pull: fix shallow clone when lastest change isn't HEAD. Previously, using `hg clone --startrev HEAD` when the actual HEAD revision didn't touch the prefix, would cause it to report that no changes were found. Using last_changed_rev instead of HEAD fixes this. In order to better test this scenario, we now clone the trunk subdirectory of all the fixtures.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Wed, 11 Aug 2010 19:57:34 +0200
parents 1add57910c82
children d101b39f6c51
files hgsubversion/wrappers.py tests/test_startrev.py
diffstat 2 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -241,7 +241,7 @@ def pull(repo, source, heads=[], force=F
         # we are initializing a new repository
         start = repo.ui.config('hgsubversion', 'startrev', 0)
         if isinstance(start, str) and start.upper() == 'HEAD':
-            start = svn.HEAD
+            start = svn.last_changed_rev
         else:
             start = int(start)
 
--- a/tests/test_startrev.py
+++ b/tests/test_startrev.py
@@ -21,7 +21,7 @@ def _do_case(self, name, subdir, stupid)
         self.assertMultiLineEqual(fulltip[f].data(), headtip[f].data())
 
 def buildmethod(case, name, subdir, stupid):
-    m = lambda self: self._do_case(case, 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'))
@@ -31,10 +31,7 @@ def buildmethod(case, name, subdir, stup
 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':
-        continue
-    subdir = test_util.subdir.get(case, '')
+    subdir = test_util.subdir.get(case, '') + '/trunk'
 
     bname = 'test_' + case[:-len('.svndump')]
     attrs[bname] = buildmethod(case, bname, subdir, False)