Page MenuHomePhabricator

mergestate: implement trivial in-memory mergestate
Needs ReviewPublic

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

Details

Reviewers
None
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.Mon, May 18, 6:08 PM
martinvonz added inline comments.
mercurial/mergestate.py
101

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.Tue, May 19, 3:52 PM
durin42 updated this revision to Diff 21512.Thu, May 28, 4:26 PM
durin42 updated this revision to Diff 21518.Thu, May 28, 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.Thu, May 28, 5:33 PM
durin42 updated this revision to Diff 21544.Mon, Jun 1, 11:50 AM