Show More
@@ -910,16 +910,17 b' def parsefilename(str):' | |||||
910 | return s[:i] |
|
910 | return s[:i] | |
911 |
|
911 | |||
912 | def selectfile(afile_orig, bfile_orig, hunk, strip): |
|
912 | def selectfile(afile_orig, bfile_orig, hunk, strip): | |
913 |
def pathstrip(path, |
|
913 | def pathstrip(path, strip): | |
914 | pathlen = len(path) |
|
914 | pathlen = len(path) | |
915 | i = 0 |
|
915 | i = 0 | |
916 |
if |
|
916 | if strip == 0: | |
917 | return '', path.rstrip() |
|
917 | return '', path.rstrip() | |
|
918 | count = strip | |||
918 | while count > 0: |
|
919 | while count > 0: | |
919 | i = path.find('/', i) |
|
920 | i = path.find('/', i) | |
920 | if i == -1: |
|
921 | if i == -1: | |
921 | raise PatchError(_("unable to strip away %d dirs from %s") % |
|
922 | raise PatchError(_("unable to strip away %d of %d dirs from %s") % | |
922 | (count, path)) |
|
923 | (count, strip, path)) | |
923 | i += 1 |
|
924 | i += 1 | |
924 | # consume '//' in the path |
|
925 | # consume '//' in the path | |
925 | while i < pathlen - 1 and path[i] == '/': |
|
926 | while i < pathlen - 1 and path[i] == '/': |
General Comments 0
You need to be logged in to leave comments.
Login now