Mercurial > hg
changeset 18830:6b827d84d286
patch: match 'diff --git a/' instead of 'diff --git'
This reduces the likelihood of a traceback when trying to email a
patch that happens to have 'diff --git' at the beginning of a line
in the description, as this patch did:
http://markmail.org/message/wxpgowxd7ucxygwe
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Fri, 22 Mar 2013 17:27:06 -0500 |
parents | 8843182f3514 |
children | 17f6644a2fbc |
files | mercurial/patch.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/patch.py Thu Mar 21 18:16:49 2013 +0100 +++ b/mercurial/patch.py Fri Mar 22 17:27:06 2013 -0500 @@ -314,7 +314,7 @@ gitpatches = [] for line in lr: line = line.rstrip(' \r\n') - if line.startswith('diff --git'): + if line.startswith('diff --git a/'): m = gitre.match(line) if m: if gp: @@ -1211,7 +1211,7 @@ emitfile = False yield 'file', (afile, bfile, h, gp and gp.copy() or None) yield 'hunk', h - elif x.startswith('diff --git'): + elif x.startswith('diff --git a/'): m = gitre.match(x.rstrip(' \r\n')) if not m: continue @@ -1815,7 +1815,7 @@ addresult() # set numbers to 0 anyway when starting new file adds, removes, isbinary = 0, 0, False - if line.startswith('diff --git'): + if line.startswith('diff --git a/'): filename = gitre.search(line).group(1) elif line.startswith('diff -r'): # format: "diff -r ... -r ... filename"