convert: inline strutil.rfindall()
authorYuya Nishihara <yuya@tcha.org>
Sun, 16 Oct 2016 16:58:43 +0900
changeset 30605 c039eb03e652
parent 30604 b654112a0119
child 30606 65835b850a72
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.
hgext/convert/subversion.py
--- 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