patch: differentiate start of file with diff --git vs '--- ' stable
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sat, 20 Mar 2010 21:16:22 +0100
branchstable
changeset 10747 b010d899665e
parent 10745 d94832c4a31d
child 10748 fb06e357e698
patch: differentiate start of file with diff --git vs '--- '
mercurial/patch.py
--- a/mercurial/patch.py	Fri Mar 19 22:52:38 2010 +0100
+++ b/mercurial/patch.py	Sat Mar 20 21:16:22 2010 +0100
@@ -1019,7 +1019,7 @@
     gitworkdone = False
 
     while True:
-        newfile = False
+        newfile = newgitfile = False
         x = lr.readline()
         if not x:
             break
@@ -1070,7 +1070,7 @@
                 if gp and gp.op in ('COPY', 'DELETE', 'RENAME', 'ADD'):
                     afile = bfile
                     gitworkdone = True
-            newfile = True
+                newgitfile = True
         elif x.startswith('---'):
             # check for a unified diff
             l2 = lr.readline()
@@ -1097,7 +1097,7 @@
             afile = parsefilename(x)
             bfile = parsefilename(l2)
 
-        if newfile:
+        if newgitfile or newfile:
             emitfile = True
             state = BFILE
             hunknum = 0