changeset 14387:e1b4a7a7263a

patch: reindent code
author Patrick Mezard <pmezard@gmail.com>
date Thu, 19 May 2011 22:44:01 +0200
parents c2ef8cc50748
children 37c997d21752
files mercurial/patch.py
diffstat 1 files changed, 16 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Thu May 19 22:44:01 2011 +0200
+++ b/mercurial/patch.py	Thu May 19 22:44:01 2011 +0200
@@ -1149,22 +1149,23 @@
                 yield 'file', (afile, bfile, h, gp and gp.mode or None)
             yield 'hunk', h
         elif x.startswith('diff --git'):
-            # check for git diff, scanning the whole patch file if needed
             m = gitre.match(x)
-            if m:
-                if not git:
-                    git = True
-                    gitpatches = scangitpatch(lr, x)
-                    for gp in gitpatches:
-                        changed['b/' + gp.path] = gp
-                    yield 'git', gitpatches
-                afile = 'a/' + m.group(1)
-                bfile = 'b/' + m.group(2)
-                gp = changed[bfile]
-                # copy/rename + modify should modify target, not source
-                if gp.op in ('COPY', 'DELETE', 'RENAME', 'ADD') or gp.mode:
-                    afile = bfile
-                newfile = True
+            if not m:
+                continue
+            if not git:
+                # scan whole input for git metadata
+                git = True
+                gitpatches = scangitpatch(lr, x)
+                for gp in gitpatches:
+                    changed['b/' + gp.path] = gp
+                yield 'git', gitpatches
+            afile = 'a/' + m.group(1)
+            bfile = 'b/' + m.group(2)
+            gp = changed[bfile]
+            # copy/rename + modify should modify target, not source
+            if gp.op in ('COPY', 'DELETE', 'RENAME', 'ADD') or gp.mode:
+                afile = bfile
+            newfile = True
         elif x.startswith('---'):
             # check for a unified diff
             l2 = lr.readline()