changeset 24242:3acb83c6c0f1

patch: rename pathstrip to pathtransform In upcoming patches we'll not just strip path components but also add new ones.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 06 Mar 2015 21:12:30 -0800
parents e7baf88c29c3
children daee2039dd11
files mercurial/patch.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Wed Feb 18 23:17:52 2015 +0900
+++ b/mercurial/patch.py	Fri Mar 06 21:12:30 2015 -0800
@@ -1087,7 +1087,7 @@
             return s
     return s[:i]
 
-def pathstrip(path, strip):
+def pathtransform(path, strip):
     pathlen = len(path)
     i = 0
     if strip == 0:
@@ -1110,9 +1110,9 @@
     nullb = bfile_orig == "/dev/null"
     create = nulla and hunk.starta == 0 and hunk.lena == 0
     remove = nullb and hunk.startb == 0 and hunk.lenb == 0
-    abase, afile = pathstrip(afile_orig, strip)
+    abase, afile = pathtransform(afile_orig, strip)
     gooda = not nulla and backend.exists(afile)
-    bbase, bfile = pathstrip(bfile_orig, strip)
+    bbase, bfile = pathtransform(bfile_orig, strip)
     if afile == bfile:
         goodb = gooda
     else:
@@ -1352,7 +1352,7 @@
                eolmode='strict'):
 
     def pstrip(p):
-        return pathstrip(p, strip - 1)[1]
+        return pathtransform(p, strip - 1)[1]
 
     rejects = 0
     err = 0
@@ -1541,9 +1541,9 @@
             if state == 'file':
                 afile, bfile, first_hunk, gp = values
                 if gp:
-                    gp.path = pathstrip(gp.path, strip - 1)[1]
+                    gp.path = pathtransform(gp.path, strip - 1)[1]
                     if gp.oldpath:
-                        gp.oldpath = pathstrip(gp.oldpath, strip - 1)[1]
+                        gp.oldpath = pathtransform(gp.oldpath, strip - 1)[1]
                 else:
                     gp = makepatchmeta(backend, afile, bfile, first_hunk, strip)
                 changed.add(gp.path)