Mercurial > public > mercurial-scm > hg-stable
diff mercurial/patch.py @ 12645:d7452292f9d3
import: don't strip '#' lines from patch descriptions (issue 2417)
Previously no '# ' lines came through the parser.
Now only the first '# ' lines are processed, from '# HG changeset patch' and to
the first line not starting with '# '.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 08 Oct 2010 23:39:44 -0500 |
parents | 05210e955bef |
children | b0fa39c68370 |
line wrap: on
line diff
--- a/mercurial/patch.py Fri Oct 08 22:36:11 2010 -0500 +++ b/mercurial/patch.py Fri Oct 08 23:39:44 2010 -0500 @@ -224,6 +224,7 @@ m = diffre.search(payload) if m: hgpatch = False + hgpatchheader = False ignoretext = False ui.debug('found patch at byte %d\n' % m.start(0)) @@ -232,12 +233,12 @@ for line in payload[:m.start(0)].splitlines(): if line.startswith('# HG changeset patch'): ui.debug('patch generated by hg export\n') - hgpatch = True + hgpatchheader = True # drop earlier commit message content cfp.seek(0) cfp.truncate() subject = None - elif hgpatch: + elif hgpatchheader: if line.startswith('# User '): user = line[7:] ui.debug('From: %s\n' % user) @@ -249,9 +250,12 @@ nodeid = line[10:] elif line.startswith("# Parent "): parents.append(line[10:]) + elif not line.startswith("# "): + hgpatchheader = False + hgpatch = True elif line == '---' and gitsendmail: ignoretext = True - if not line.startswith('# ') and not ignoretext: + if not hgpatchheader and not ignoretext: cfp.write(line) cfp.write('\n') message = cfp.getvalue()