mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
histedit: avoid pointless merge for "fold"/"roll"
Summary: The fold action collapsed commits up to and including the working copy, but it left the working copy dirty. When it subsequently updated to the new collapsed commit, it "merged" all the files. They merge cleanly since their contents are identical, but we still invoke the merge drivers (why are we invoking merge drivers if the contents are identical?). Fix by using ctx.markcommitted() which updates the dirstate based on what was committed. And, we no longer need to do the "hg.update()" anymore since the working copy will already be on the collapsed commit. Reviewed By: quark-zju, zzl0 Differential Revision: D43718659 fbshipit-source-id: 26865cca11feb600e21933c60ed83796212da954
This commit is contained in:
parent
990a7c50a7
commit
f425cf9998
@ -723,7 +723,9 @@ def collapse(repo, first, commitopts, skipprompt=False):
|
||||
loginfo=loginfo,
|
||||
mutinfo=mutinfo,
|
||||
)
|
||||
return repo.commitctx(new)
|
||||
n = repo.commitctx(new)
|
||||
new.markcommitted(n)
|
||||
return n
|
||||
|
||||
|
||||
def _isdirtywc(repo):
|
||||
@ -894,10 +896,6 @@ class fold(histeditaction):
|
||||
n = collapse(repo, ctx, commitopts, skipprompt=self.skipprompt())
|
||||
if n is None:
|
||||
return ctx, []
|
||||
repo.ui.pushbuffer()
|
||||
with repo.transaction("fold-checkout"):
|
||||
hg.update(repo, n)
|
||||
repo.ui.popbuffer()
|
||||
mergemod.mergestate.read(repo).reset()
|
||||
replacements = [
|
||||
(oldctx.node(), (n,)),
|
||||
|
@ -575,4 +575,24 @@ Test rolling into a commit with multiple children (issue5498)
|
||||
├─╯
|
||||
o 8f0162e483d0 aa
|
||||
|
||||
$ cd ..
|
||||
|
||||
Fold/roll shouldn't trigger a merge:
|
||||
|
||||
$ hg init rollmerge
|
||||
$ cd rollmerge
|
||||
$ echo a > a
|
||||
$ hg commit -qAm a
|
||||
$ echo b > a
|
||||
$ hg commit -qAm b
|
||||
$ hg log -G -T '{node|short} {desc}'
|
||||
@ 1e6c11564562 b
|
||||
│
|
||||
o cb9a9f314b8b a
|
||||
Set a bogus mergedriver as a tripwire to make sure we don't invoke merge driver.
|
||||
$ hg histedit --config extensions.mergedriver= --config experimental.mergedriver=dontrunthis --commands - << EOF
|
||||
> p cb9a9f314b8b
|
||||
> r 1e6c11564562
|
||||
> EOF
|
||||
$ hg log -G -T '{node|short} {desc}'
|
||||
@ 9e233947f73d a
|
||||
|
Loading…
Reference in New Issue
Block a user