Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 19513:9e8298a324ac stable
import: cut commit messages at --- unconditionally (issue2148)
We used to do this based on X-mailer: mentioning git, but git doesn't
put X-mailer in its git-format-patch output.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 27 Jul 2013 19:31:14 -0500 |
parents | 0b3689a08df5 |
children | b054a241257d c172660eee01 |
comparison
equal
deleted
inserted
replaced
19512:f84036df71ad | 19513:9e8298a324ac |
---|---|
174 user = msg['From'] | 174 user = msg['From'] |
175 if not subject and not user: | 175 if not subject and not user: |
176 # Not an email, restore parsed headers if any | 176 # Not an email, restore parsed headers if any |
177 subject = '\n'.join(': '.join(h) for h in msg.items()) + '\n' | 177 subject = '\n'.join(': '.join(h) for h in msg.items()) + '\n' |
178 | 178 |
179 gitsendmail = 'git-send-email' in msg.get('X-Mailer', '') | |
180 # should try to parse msg['Date'] | 179 # should try to parse msg['Date'] |
181 date = None | 180 date = None |
182 nodeid = None | 181 nodeid = None |
183 branch = None | 182 branch = None |
184 parents = [] | 183 parents = [] |
231 nodeid = line[10:] | 230 nodeid = line[10:] |
232 elif line.startswith("# Parent "): | 231 elif line.startswith("# Parent "): |
233 parents.append(line[9:].lstrip()) | 232 parents.append(line[9:].lstrip()) |
234 elif not line.startswith("# "): | 233 elif not line.startswith("# "): |
235 hgpatchheader = False | 234 hgpatchheader = False |
236 elif line == '---' and gitsendmail: | 235 elif line == '---': |
237 ignoretext = True | 236 ignoretext = True |
238 if not hgpatchheader and not ignoretext: | 237 if not hgpatchheader and not ignoretext: |
239 cfp.write(line) | 238 cfp.write(line) |
240 cfp.write('\n') | 239 cfp.write('\n') |
241 message = cfp.getvalue() | 240 message = cfp.getvalue() |