--- a/hgext/convert/filemap.py Sun Nov 17 11:16:59 2013 -0500
+++ b/hgext/convert/filemap.py Sun Nov 17 11:18:39 2013 -0500
@@ -10,12 +10,20 @@
from mercurial import util, error
from common import SKIPREV, converter_source
-def rpairs(name):
- e = len(name)
- while e != -1:
- yield name[:e], name[e + 1:]
- e = name.rfind('/', 0, e)
- yield '.', name
+def rpairs(path):
+ '''Yield tuples with path split at '/', starting with the full path.
+ No leading, trailing or double '/', please.
+ >>> for x in rpairs('foo/bar/baz'): print x
+ ('foo/bar/baz', '')
+ ('foo/bar', 'baz')
+ ('foo', 'bar/baz')
+ ('.', 'foo/bar/baz')
+ '''
+ i = len(path)
+ while i != -1:
+ yield path[:i], path[i + 1:]
+ i = path.rfind('/', 0, i)
+ yield '.', path
def normalize(path):
''' We use posixpath.normpath to support cross-platform path format.
--- a/tests/test-doctest.py Sun Nov 17 11:16:59 2013 -0500
+++ b/tests/test-doctest.py Sun Nov 17 11:18:39 2013 -0500
@@ -26,3 +26,4 @@
testmod('mercurial.util')
testmod('mercurial.util', testtarget='platform')
testmod('hgext.convert.cvsps')
+testmod('hgext.convert.filemap')