Mercurial > hg > mercurial-source
changeset 4887:bbdcacf7cef8
mq: autodetect an existing git patch during qrefresh (issue 491)
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon, 16 Jul 2007 16:50:47 -0700 |
parents | 2f09df302f30 |
children | 2d545b98a7bc |
files | hgext/mq.py tests/test-mq tests/test-mq.out |
diffstat | 3 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py +++ b/hgext/mq.py @@ -909,7 +909,16 @@ patchparent = self.qparents(repo, top) message, comments, user, date, patchfound = self.readheaders(patchfn) - patchf = self.opener(patchfn, "w") + 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'): + self.diffopts().git = True + break + patchf.seek(0) + patchf.truncate() + msg = opts.get('msg', '').rstrip() if msg: if comments: