Mercurial > public > mercurial-scm > hg
diff hgext/mq.py @ 10186:296a0b14a686 stable 1.4.2
mq: preserve --git flag when folding patches
Without this, folding a git patch into a regular one downgrades the resulting
patch to a regular patch.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 01 Jan 2010 19:53:05 +0100 |
parents | 7637fe4f525d |
children | fcc15ba18c03 fd6e9c7cd98c 25e572394f5c |
line wrap: on
line diff
--- a/hgext/mq.py Fri Jan 01 19:53:05 2010 +0100 +++ b/hgext/mq.py Fri Jan 01 19:53:05 2010 +0100 @@ -264,18 +264,19 @@ diffopts = self.patchopts(diffopts, patchfn) return diffopts - def patchopts(self, diffopts, patchfn): + def patchopts(self, diffopts, *patches): """Return a copy of input diff options with git set to true if referenced patch is a git patch. """ diffopts = diffopts.copy() - patchf = self.opener(patchfn, 'r') - # if the patch was a git patch, refresh it as a git patch - for line in patchf: - if line.startswith('diff --git'): - diffopts.git = True - break - patchf.close() + for patchfn in patches: + patchf = self.opener(patchfn, 'r') + # if the patch was a git patch, refresh it as a git patch + for line in patchf: + if line.startswith('diff --git'): + diffopts.git = True + break + patchf.close() return diffopts def join(self, *p): @@ -2070,7 +2071,8 @@ if opts['edit']: message = ui.edit(message, user or ui.username()) - q.refresh(repo, msg=message) + diffopts = q.patchopts(q.diffopts(), *patches) + q.refresh(repo, msg=message, git=diffopts.git) q.delete(repo, patches, opts) q.save_dirty()