mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
mq: autodetect an existing git patch during qrefresh (issue 491)
This commit is contained in:
parent
d4bd9b2ed8
commit
e1c7de520a
11
hgext/mq.py
11
hgext/mq.py
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user