Show More
@@ -1088,6 +1088,22 b' def parsefilename(str):' | |||
|
1088 | 1088 | return s[:i] |
|
1089 | 1089 | |
|
1090 | 1090 | def pathtransform(path, strip): |
|
1091 | '''turn a path from a patch into a path suitable for the repository | |
|
1092 | ||
|
1093 | Returns (stripped components, path in repository). | |
|
1094 | ||
|
1095 | >>> pathtransform('a/b/c', 0) | |
|
1096 | ('', 'a/b/c') | |
|
1097 | >>> pathtransform(' a/b/c ', 0) | |
|
1098 | ('', ' a/b/c') | |
|
1099 | >>> pathtransform(' a/b/c ', 2) | |
|
1100 | ('a/b/', 'c') | |
|
1101 | >>> pathtransform(' a//b/c ', 2) | |
|
1102 | ('a//b/', 'c') | |
|
1103 | >>> pathtransform('a/b/c', 3) | |
|
1104 | Traceback (most recent call last): | |
|
1105 | PatchError: unable to strip away 1 of 3 dirs from a/b/c | |
|
1106 | ''' | |
|
1091 | 1107 | pathlen = len(path) |
|
1092 | 1108 | i = 0 |
|
1093 | 1109 | if strip == 0: |
General Comments 0
You need to be logged in to leave comments.
Login now