1135 or (context is not False and x.startswith('***************')) |
1135 or (context is not False and x.startswith('***************')) |
1136 or x.startswith('GIT binary patch')): |
1136 or x.startswith('GIT binary patch')): |
1137 gp = changed.get(bfile) |
1137 gp = changed.get(bfile) |
1138 if x.startswith('GIT binary patch'): |
1138 if x.startswith('GIT binary patch'): |
1139 h = binhunk(gp, lr) |
1139 h = binhunk(gp, lr) |
1140 afile = 'a/' + afile |
|
1141 bfile = 'b/' + bfile |
|
1142 else: |
1140 else: |
1143 if context is None and x.startswith('***************'): |
1141 if context is None and x.startswith('***************'): |
1144 context = True |
1142 context = True |
1145 create = afile == '/dev/null' or gp and gp.op == 'ADD' |
1143 create = afile == '/dev/null' or gp and gp.op == 'ADD' |
1146 remove = bfile == '/dev/null' or gp and gp.op == 'DELETE' |
1144 remove = bfile == '/dev/null' or gp and gp.op == 'DELETE' |
1152 yield 'hunk', h |
1150 yield 'hunk', h |
1153 elif x.startswith('diff --git'): |
1151 elif x.startswith('diff --git'): |
1154 # check for git diff, scanning the whole patch file if needed |
1152 # check for git diff, scanning the whole patch file if needed |
1155 m = gitre.match(x) |
1153 m = gitre.match(x) |
1156 if m: |
1154 if m: |
1157 afile, bfile = m.group(1, 2) |
|
1158 if not git: |
1155 if not git: |
1159 git = True |
1156 git = True |
1160 gitpatches = scangitpatch(lr, x) |
1157 gitpatches = scangitpatch(lr, x) |
1161 for gp in gitpatches: |
1158 for gp in gitpatches: |
1162 changed[gp.path] = gp |
1159 changed['b/' + gp.path] = gp |
1163 yield 'git', gitpatches |
1160 yield 'git', gitpatches |
|
1161 afile = 'a/' + m.group(1) |
|
1162 bfile = 'b/' + m.group(2) |
|
1163 gp = changed[bfile] |
1164 # copy/rename + modify should modify target, not source |
1164 # copy/rename + modify should modify target, not source |
1165 gp = changed[bfile] |
|
1166 if gp.op in ('COPY', 'DELETE', 'RENAME', 'ADD') or gp.mode: |
1165 if gp.op in ('COPY', 'DELETE', 'RENAME', 'ADD') or gp.mode: |
1167 afile = bfile |
1166 afile = bfile |
1168 newfile = True |
1167 newfile = True |
1169 elif x.startswith('---'): |
1168 elif x.startswith('---'): |
1170 # check for a unified diff |
1169 # check for a unified diff |