mq: autodetect an existing git patch during qrefresh (issue 491)

This commit is contained in:
Bryan O'Sullivan 2007-07-16 16:50:47 -07:00
parent d4bd9b2ed8
commit e1c7de520a
3 changed files with 14 additions and 1 deletions

View File

@ -909,7 +909,16 @@ class queue:
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:

View File

@ -319,6 +319,8 @@ hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
hg qrefresh --git
cat .hg/patches/bar
hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
hg qrefresh
grep 'diff --git' .hg/patches/bar
echo
hg up -C 1

View File

@ -325,6 +325,8 @@ diff --git a/foo b/baz
rename from foo
rename to baz
2 baz (foo)
diff --git a/bar b/bar
diff --git a/foo b/baz
1 files updated, 0 files merged, 2 files removed, 0 files unresolved
2 files updated, 0 files merged, 1 files removed, 0 files unresolved