# HG changeset patch # User Siddharth Agarwal # Date 1425705150 28800 # Node ID 3acb83c6c0f162d9ad9965a0978bb43eca32371e # Parent e7baf88c29c32dcc8446301fff4c77038f241694 patch: rename pathstrip to pathtransform In upcoming patches we'll not just strip path components but also add new ones. diff -r e7baf88c29c3 -r 3acb83c6c0f1 mercurial/patch.py --- 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)