mercurial/patch.py
changeset 46246 416ecdaa12df
parent 46034 2cf61e66c6d0
child 46375 33350debb480
equal deleted inserted replaced
46245:db2bc9e667a1 46246:416ecdaa12df
   391 
   391 
   392     # Filter patch for git information
   392     # Filter patch for git information
   393     gp = None
   393     gp = None
   394     gitpatches = []
   394     gitpatches = []
   395     for line in lr:
   395     for line in lr:
   396         line = line.rstrip(b' \r\n')
   396         line = line.rstrip(b'\r\n')
   397         if line.startswith(b'diff --git a/'):
   397         if line.startswith(b'diff --git a/'):
   398             m = gitre.match(line)
   398             m = gitre.match(line)
   399             if m:
   399             if m:
   400                 if gp:
   400                 if gp:
   401                     gitpatches.append(gp)
   401                     gitpatches.append(gp)
  2071             if emitfile:
  2071             if emitfile:
  2072                 emitfile = False
  2072                 emitfile = False
  2073                 yield b'file', (afile, bfile, h, gp and gp.copy() or None)
  2073                 yield b'file', (afile, bfile, h, gp and gp.copy() or None)
  2074             yield b'hunk', h
  2074             yield b'hunk', h
  2075         elif x.startswith(b'diff --git a/'):
  2075         elif x.startswith(b'diff --git a/'):
  2076             m = gitre.match(x.rstrip(b' \r\n'))
  2076             m = gitre.match(x.rstrip(b'\r\n'))
  2077             if not m:
  2077             if not m:
  2078                 continue
  2078                 continue
  2079             if gitpatches is None:
  2079             if gitpatches is None:
  2080                 # scan whole input for git metadata
  2080                 # scan whole input for git metadata
  2081                 gitpatches = scangitpatch(lr, x)
  2081                 gitpatches = scangitpatch(lr, x)