198 gp = None |
199 gp = None |
199 dopatch |= GP_PATCH |
200 dopatch |= GP_PATCH |
200 continue |
201 continue |
201 if line.startswith('rename from '): |
202 if line.startswith('rename from '): |
202 gp.op = 'RENAME' |
203 gp.op = 'RENAME' |
203 gp.oldpath = line[12:].rstrip() |
204 gp.oldpath = line[12:] |
204 elif line.startswith('rename to '): |
205 elif line.startswith('rename to '): |
205 gp.path = line[10:].rstrip() |
206 gp.path = line[10:] |
206 elif line.startswith('copy from '): |
207 elif line.startswith('copy from '): |
207 gp.op = 'COPY' |
208 gp.op = 'COPY' |
208 gp.oldpath = line[10:].rstrip() |
209 gp.oldpath = line[10:] |
209 elif line.startswith('copy to '): |
210 elif line.startswith('copy to '): |
210 gp.path = line[8:].rstrip() |
211 gp.path = line[8:] |
211 elif line.startswith('deleted file'): |
212 elif line.startswith('deleted file'): |
212 gp.op = 'DELETE' |
213 gp.op = 'DELETE' |
213 # is the deleted file a symlink? |
214 # is the deleted file a symlink? |
214 gp.setmode(int(line.rstrip()[-6:], 8)) |
215 gp.setmode(int(line[-6:], 8)) |
215 elif line.startswith('new file mode '): |
216 elif line.startswith('new file mode '): |
216 gp.op = 'ADD' |
217 gp.op = 'ADD' |
217 gp.setmode(int(line.rstrip()[-6:], 8)) |
218 gp.setmode(int(line[-6:], 8)) |
218 elif line.startswith('new mode '): |
219 elif line.startswith('new mode '): |
219 gp.setmode(int(line.rstrip()[-6:], 8)) |
220 gp.setmode(int(line[-6:], 8)) |
220 elif line.startswith('GIT binary patch'): |
221 elif line.startswith('GIT binary patch'): |
221 dopatch |= GP_BINARY |
222 dopatch |= GP_BINARY |
222 gp.binary = True |
223 gp.binary = True |
223 if gp: |
224 if gp: |
224 gitpatches.append(gp) |
225 gitpatches.append(gp) |