This is an archive of the discontinued Mercurial Phabricator instance.

mergestate: implement trivial in-memory mergestate
AbandonedPublic

Authored by durin42 on May 18 2020, 6:08 PM.

Details

Reviewers
marmoute
Group Reviewers
hg-reviewers
Summary

This is the dumbest possible "mergestate" implementation: it doesn't actually
handle conflict storage in the slightest, but for the current in-memory merge
cases it works great, and prevents us from accidentally touching .hg/merge
while doing non-wdir operations.

NOT DONE: this breaks tests in future changes in the series, currently getting
stuck on the "premerge()" method in the mergestate object.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

durin42 created this revision.May 18 2020, 6:08 PM
martinvonz added inline comments.
mercurial/mergestate.py
94

Can we really get the merge driver to work with memmergestate? Maybe it's better to make memmergestate.mergedriver raise an exception so we catch it?

Ah, I was curious how that could possibly work so far and it turns out that there is indeed a check at merge.py:2039. You could move that exception to memmergestate.mergedriver, I think.

durin42 updated this revision to Diff 21452.May 19 2020, 3:52 PM
durin42 updated this revision to Diff 21512.May 28 2020, 4:26 PM
durin42 updated this revision to Diff 21518.May 28 2020, 5:10 PM

This is now much closer! I'm down to a handful of failures, all like this:

--- tests/test-copies-in-changeset.t
+++ hgtest/tests/test-copies-in-changeset.t#sidedata.err
@@ -358,6 +358,8 @@
   $ hg ci -qm 'rename a to b'
   $ hg rebase -d 1 --config rebase.experimental.inmemory=yes
   rebasing 2:* "rename a to b" (tip) (glob)
+  hit merge conflicts; re-running rebase without in-memory merge
+  rebasing 2:b977edf6f839 "rename a to b" (tip)
   merging a and b to b
   saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/*-*-rebase.hg (glob)
   $ hg st --change . --copies

ERROR: test-copies-in-changeset.t#sidedata output changed
--- tests/test-rebase-inmemory.t
+++ tests/test-rebase-inmemory.t.err
@@ -780,6 +780,8 @@
   $ hg ci -qm 'rename a to b'
   $ hg rebase -d 1
   rebasing 2:b977edf6f839 "rename a to b" (tip)
+  hit merge conflicts; re-running rebase without in-memory merge
+  rebasing 2:b977edf6f839 "rename a to b" (tip)
   merging a and b to b
   saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
   $ hg st --copies --change .
@@ -801,6 +803,8 @@
   $ hg ci -qm 'rename a to b'
   $ hg rebase -d 1
   rebasing 2:b977edf6f839 "rename a to b" (tip)
+  hit merge conflicts; re-running rebase without in-memory merge
+  rebasing 2:b977edf6f839 "rename a to b" (tip)
   merging a and b to b
   saved backup bundle to $TESTTMP/rebase-rename-empty/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
   $ hg st --copies --change .
@@ -820,6 +824,8 @@
   $ echo a2 > a
   $ hg ci -qm 'modify a'
   $ hg rebase -r . -d 1 --collapse
+  rebasing 2:41c4ea50d4cf "modify a" (tip)
+  hit merge conflicts; re-running rebase without in-memory merge
   rebasing 2:41c4ea50d4cf "modify a" (tip)
   merging b and a to b
   saved backup bundle to $TESTTMP/rebase-rename-collapse/.hg/strip-backup/41c4ea50d4cf-b90b7994-rebase.hg

ERROR: test-rebase-inmemory.t output changed

Clearly I'm tickling some merge logic that previously went unused in the IMM case, and it'll take some investigating, but I suspect that long-term this will let us run more merges in-memory without having to revert to on-disk merge logic.

durin42 updated this revision to Diff 21519.May 28 2020, 5:33 PM
durin42 updated this revision to Diff 21544.Jun 1 2020, 11:50 AM
durin42 updated this revision to Diff 21611.Jun 11 2020, 12:07 PM
durin42 updated this revision to Diff 21620.Jun 11 2020, 1:04 PM
durin42 updated this revision to Diff 21623.Jun 11 2020, 3:45 PM
marmoute requested changes to this revision.Jul 31 2020, 12:02 PM
marmoute added a subscriber: marmoute.

According to IRC discussion, this series is not ready for review, so moving it out of yadda.

This revision now requires changes to proceed.Jul 31 2020, 12:02 PM
durin42 abandoned this revision.Oct 2 2020, 2:49 PM