Show More
@@ -148,8 +148,10 b' class patchmeta:' | |||
|
148 | 148 | |
|
149 | 149 | 'op' is the performed operation within ADD, DELETE, RENAME, MODIFY |
|
150 | 150 | or COPY. 'path' is patched file path. 'oldpath' is set to the |
|
151 | origin file when 'op' is either COPY or RENAME, None | |
|
152 | otherwise. 'mode' is set to the new mode of patched file or None. | |
|
151 | origin file when 'op' is either COPY or RENAME, None otherwise. If | |
|
152 | file mode is changed, 'mode' is a tuple (islink, isexec) where | |
|
153 | 'islink' is True if the file is a symlink and 'isexec' is True if | |
|
154 | the file is executable. Otherwise, 'mode' is None. | |
|
153 | 155 | """ |
|
154 | 156 | def __init__(self, path): |
|
155 | 157 | self.path = path |
@@ -159,6 +161,11 b' class patchmeta:' | |||
|
159 | 161 | self.lineno = 0 |
|
160 | 162 | self.binary = False |
|
161 | 163 | |
|
164 | def setmode(self, mode): | |
|
165 | islink = mode & 020000 | |
|
166 | isexec = mode & 0100 | |
|
167 | self.mode = (islink, isexec) | |
|
168 | ||
|
162 | 169 | def readgitpatch(fp, firstline=None): |
|
163 | 170 | """extract git-style metadata about patches from <patchname>""" |
|
164 | 171 | |
@@ -208,9 +215,9 b' def readgitpatch(fp, firstline=None):' | |||
|
208 | 215 | gp.op = 'DELETE' |
|
209 | 216 | elif line.startswith('new file mode '): |
|
210 | 217 | gp.op = 'ADD' |
|
211 |
gp. |
|
|
218 | gp.setmode(int(line.rstrip()[-6:], 8)) | |
|
212 | 219 | elif line.startswith('new mode '): |
|
213 |
gp. |
|
|
220 | gp.setmode(int(line.rstrip()[-6:], 8)) | |
|
214 | 221 | elif line.startswith('GIT binary patch'): |
|
215 | 222 | dopatch |= GP_BINARY |
|
216 | 223 | gp.binary = True |
@@ -1096,17 +1103,14 b' def updatedir(ui, repo, patches):' | |||
|
1096 | 1103 | for f in patches: |
|
1097 | 1104 | ctype, gp = patches[f] |
|
1098 | 1105 | if gp and gp.mode: |
|
1099 | flags = '' | |
|
1100 | if gp.mode & 0100: | |
|
1101 | flags = 'x' | |
|
1102 | elif gp.mode & 020000: | |
|
1103 | flags = 'l' | |
|
1106 | islink, isexec = gp.mode | |
|
1104 | 1107 | dst = os.path.join(repo.root, gp.path) |
|
1105 | 1108 | # patch won't create empty files |
|
1106 | 1109 | if ctype == 'ADD' and not os.path.exists(dst): |
|
1110 | flags = (isexec and 'x' or '') + (islink and 'l' or '') | |
|
1107 | 1111 | repo.wwrite(gp.path, '', flags) |
|
1108 | 1112 | else: |
|
1109 |
util.set_flags(dst, |
|
|
1113 | util.set_flags(dst, islink, isexec) | |
|
1110 | 1114 | cmdutil.addremove(repo, cfiles) |
|
1111 | 1115 | files = patches.keys() |
|
1112 | 1116 | files.extend([r for r in removes if r not in files]) |
General Comments 0
You need to be logged in to leave comments.
Login now