Show More
@@ -280,10 +280,6 b' def extract(ui, fileobj):' | |||
|
280 | 280 | p2 = parents and parents.pop(0) or None |
|
281 | 281 | return tmpname, message, user, date, branch, nodeid, p1, p2 |
|
282 | 282 | |
|
283 | GP_PATCH = 1 << 0 # we have to run patch | |
|
284 | GP_FILTER = 1 << 1 # there's some copy/rename operation | |
|
285 | GP_BINARY = 1 << 2 # there's a binary patch | |
|
286 | ||
|
287 | 283 | class patchmeta(object): |
|
288 | 284 | """Patched file metadata |
|
289 | 285 | |
@@ -316,9 +312,6 b' def readgitpatch(lr):' | |||
|
316 | 312 | # Filter patch for git information |
|
317 | 313 | gp = None |
|
318 | 314 | gitpatches = [] |
|
319 | # Can have a git patch with only metadata, causing patch to complain | |
|
320 | dopatch = 0 | |
|
321 | ||
|
322 | 315 | lineno = 0 |
|
323 | 316 | for line in lr: |
|
324 | 317 | lineno += 1 |
@@ -333,11 +326,8 b' def readgitpatch(lr):' | |||
|
333 | 326 | gp.lineno = lineno |
|
334 | 327 | elif gp: |
|
335 | 328 | if line.startswith('--- '): |
|
336 | if gp.op in ('COPY', 'RENAME'): | |
|
337 | dopatch |= GP_FILTER | |
|
338 | 329 | gitpatches.append(gp) |
|
339 | 330 | gp = None |
|
340 | dopatch |= GP_PATCH | |
|
341 | 331 | continue |
|
342 | 332 | if line.startswith('rename from '): |
|
343 | 333 | gp.op = 'RENAME' |
@@ -357,15 +347,11 b' def readgitpatch(lr):' | |||
|
357 | 347 | elif line.startswith('new mode '): |
|
358 | 348 | gp.setmode(int(line[-6:], 8)) |
|
359 | 349 | elif line.startswith('GIT binary patch'): |
|
360 | dopatch |= GP_BINARY | |
|
361 | 350 | gp.binary = True |
|
362 | 351 | if gp: |
|
363 | 352 | gitpatches.append(gp) |
|
364 | 353 | |
|
365 |
|
|
|
366 | dopatch = GP_PATCH | |
|
367 | ||
|
368 | return (dopatch, gitpatches) | |
|
354 | return gitpatches | |
|
369 | 355 | |
|
370 | 356 | class linereader(object): |
|
371 | 357 | # simple class to allow pushing lines back into the input stream |
@@ -986,9 +972,9 b' def scangitpatch(lr, firstline):' | |||
|
986 | 972 | fp = cStringIO.StringIO(lr.fp.read()) |
|
987 | 973 | gitlr = linereader(fp, lr.textmode) |
|
988 | 974 | gitlr.push(firstline) |
|
989 |
|
|
|
975 | gitpatches = readgitpatch(gitlr) | |
|
990 | 976 | fp.seek(pos) |
|
991 |
return |
|
|
977 | return gitpatches | |
|
992 | 978 | |
|
993 | 979 | def iterhunks(ui, fp, sourcefile=None): |
|
994 | 980 | """Read a patch and yield the following events: |
@@ -1062,7 +1048,7 b' def iterhunks(ui, fp, sourcefile=None):' | |||
|
1062 | 1048 | afile, bfile = m.group(1, 2) |
|
1063 | 1049 | if not git: |
|
1064 | 1050 | git = True |
|
1065 |
gitpatches = scangitpatch(lr, x) |
|
|
1051 | gitpatches = scangitpatch(lr, x) | |
|
1066 | 1052 | yield 'git', gitpatches |
|
1067 | 1053 | for gp in gitpatches: |
|
1068 | 1054 | changed[gp.path] = gp |
General Comments 0
You need to be logged in to leave comments.
Login now