Patchwork D8568: overlayworkingctx: implement mergestate() using in-memory mergestate

login
register
mail settings
Submitter phabricator
Date May 18, 2020, 10:10 p.m.
Message ID <differential-rev-PHID-DREV-vgxfk7twe5uec2rvebqi-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46356/
State New
Headers show

Comments

phabricator - May 18, 2020, 10:10 p.m.
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will allow `hg fix` to use the mergestate() method without regressing.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8568

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2520,6 +2520,7 @@ 
         return len(self._cache) == 0
 
     def clean(self):
+        self._mergestate = None
         self._cache = {}
 
     def _compact(self):
@@ -2580,6 +2581,11 @@ 
             self._repo, path, parent=self, filelog=filelog
         )
 
+    def mergestate(self, clean=False):
+        if clean or self._mergestate is None:
+            self._mergestate = mergestatemod.memmergestate(self._repo)
+        return self._mergestate
+
 
 class overlayworkingfilectx(committablefilectx):
     """Wrap a ``workingfilectx`` but intercepts all writes into an in-memory