Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 14387:e1b4a7a7263a
patch: reindent code
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Thu, 19 May 2011 22:44:01 +0200 |
parents | c2ef8cc50748 |
children | 37c997d21752 |
comparison
equal
deleted
inserted
replaced
14386:c2ef8cc50748 | 14387:e1b4a7a7263a |
---|---|
1147 if emitfile: | 1147 if emitfile: |
1148 emitfile = False | 1148 emitfile = False |
1149 yield 'file', (afile, bfile, h, gp and gp.mode or None) | 1149 yield 'file', (afile, bfile, h, gp and gp.mode or None) |
1150 yield 'hunk', h | 1150 yield 'hunk', h |
1151 elif x.startswith('diff --git'): | 1151 elif x.startswith('diff --git'): |
1152 # check for git diff, scanning the whole patch file if needed | |
1153 m = gitre.match(x) | 1152 m = gitre.match(x) |
1154 if m: | 1153 if not m: |
1155 if not git: | 1154 continue |
1156 git = True | 1155 if not git: |
1157 gitpatches = scangitpatch(lr, x) | 1156 # scan whole input for git metadata |
1158 for gp in gitpatches: | 1157 git = True |
1159 changed['b/' + gp.path] = gp | 1158 gitpatches = scangitpatch(lr, x) |
1160 yield 'git', gitpatches | 1159 for gp in gitpatches: |
1161 afile = 'a/' + m.group(1) | 1160 changed['b/' + gp.path] = gp |
1162 bfile = 'b/' + m.group(2) | 1161 yield 'git', gitpatches |
1163 gp = changed[bfile] | 1162 afile = 'a/' + m.group(1) |
1164 # copy/rename + modify should modify target, not source | 1163 bfile = 'b/' + m.group(2) |
1165 if gp.op in ('COPY', 'DELETE', 'RENAME', 'ADD') or gp.mode: | 1164 gp = changed[bfile] |
1166 afile = bfile | 1165 # copy/rename + modify should modify target, not source |
1167 newfile = True | 1166 if gp.op in ('COPY', 'DELETE', 'RENAME', 'ADD') or gp.mode: |
1167 afile = bfile | |
1168 newfile = True | |
1168 elif x.startswith('---'): | 1169 elif x.startswith('---'): |
1169 # check for a unified diff | 1170 # check for a unified diff |
1170 l2 = lr.readline() | 1171 l2 = lr.readline() |
1171 if not l2.startswith('+++'): | 1172 if not l2.startswith('+++'): |
1172 lr.push(l2) | 1173 lr.push(l2) |