diff hgext/convert/subversion.py @ 30610:c039eb03e652

convert: inline strutil.rfindall() This is the only place where strutil is used. I don't think it's worth to keep the strutil module, so inline it. Also, strutil.rfindall() appears to have off-by-one error. 'end = c - 1' is wrong because 'end' is exclusive.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 16 Oct 2016 16:58:43 +0900
parents 20a42325fdef
children 7a3e67bfa417
line wrap: on
line diff
--- a/hgext/convert/subversion.py	Wed Dec 14 12:07:23 2016 -0800
+++ b/hgext/convert/subversion.py	Sun Oct 16 16:58:43 2016 +0900
@@ -14,7 +14,6 @@
     error,
     pycompat,
     scmutil,
-    strutil,
     util,
 )
 
@@ -1239,7 +1238,8 @@
         for f in files:
             if os.path.isdir(self.wjoin(f)):
                 dirs.add(f)
-            for i in strutil.rfindall(f, '/'):
+            i = len(f)
+            for i in iter(lambda: f.rfind('/', 0, i), -1):
                 dirs.add(f[:i])
         return dirs