comparison mercurial/patch.py @ 14385:7709cc983025

patch: git metadata was ignored if strip > 1 gitpatch objects emitted by iterhunks() are modified in place by applydiff(). Processing them earlier improves iterhunks() isolation. applydiff() modifying them should still be fixed though.
author Patrick Mezard <pmezard@gmail.com>
date Thu, 19 May 2011 22:44:01 +0200
parents 9d59c596eb9e
children c2ef8cc50748
comparison
equal deleted inserted replaced
14384:9d59c596eb9e 14385:7709cc983025
1156 if m: 1156 if m:
1157 afile, bfile = m.group(1, 2) 1157 afile, bfile = m.group(1, 2)
1158 if not git: 1158 if not git:
1159 git = True 1159 git = True
1160 gitpatches = scangitpatch(lr, x) 1160 gitpatches = scangitpatch(lr, x)
1161 yield 'git', gitpatches
1162 for gp in gitpatches: 1161 for gp in gitpatches:
1163 changed[gp.path] = gp 1162 changed[gp.path] = gp
1164 # else error? 1163 yield 'git', gitpatches
1165 # copy/rename + modify should modify target, not source 1164 # copy/rename + modify should modify target, not source
1166 gp = changed.get(bfile) 1165 gp = changed[bfile]
1167 if gp and (gp.op in ('COPY', 'DELETE', 'RENAME', 'ADD') 1166 if gp.op in ('COPY', 'DELETE', 'RENAME', 'ADD') or gp.mode:
1168 or gp.mode):
1169 afile = bfile 1167 afile = bfile
1170 newfile = True 1168 newfile = True
1171 elif x.startswith('---'): 1169 elif x.startswith('---'):
1172 # check for a unified diff 1170 # check for a unified diff
1173 l2 = lr.readline() 1171 l2 = lr.readline()