Patchwork D7667: status: extract active-merge state for reuse

login
register
mail settings
Submitter phabricator
Date Dec. 19, 2019, 7:48 a.m.
Message ID <6c3a47e05f51d08c32019131e4559205@localhost.localdomain>
Download mbox | patch
Permalink /patch/43988/
State Not Applicable
Headers show

Comments

phabricator - Dec. 19, 2019, 7:48 a.m.
rdamazio retitled this revision from "status: make morestatus call out unresolved conflicts after update" to "status: extract active-merge state for reuse".
rdamazio updated this revision to Diff 18875.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7667?vs=18845&id=18875

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7667/new/

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS




To: rdamazio, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -808,12 +808,12 @@ 
     reporoot = attr.ib()
     unfinishedop = attr.ib()
     unfinishedmsg = attr.ib()
-    inmergestate = attr.ib()
+    activemerge = attr.ib()
     unresolvedpaths = attr.ib()
     _label = b'status.morestatus'
 
     def formatfile(self, path, fm):
-        if self.inmergestate and path in self.unresolvedpaths:
+        if self.activemerge and path in self.unresolvedpaths:
             fm.data(unresolved=True)
 
     def formatfooter(self, fm):
@@ -837,7 +837,7 @@ 
             )
 
     def _formatconflicts(self, fm):
-        if not self.inmergestate:
+        if not self.activemerge:
             return
 
         if self.unresolvedpaths:
@@ -867,21 +867,22 @@ 
 def readmorestatus(repo):
     """Returns a morestatus object if the repo has unfinished state."""
     statetuple = statemod.getrepostate(repo)
+    mergestate = mergemod.mergestate.read(repo)
+    activemerge = mergestate.active()
     if not statetuple:
         return None
 
     unfinishedop, unfinishedmsg = statetuple
     mergestate = mergemod.mergestate.read(repo)
     unresolved = None
-    if mergestate.active():
+    if activemerge:
         unresolved = sorted(mergestate.unresolved())
     return morestatus(
         repo.root,
         unfinishedop,
         unfinishedmsg,
-        unresolved is not None,
-        unresolved,
-    )
+        activemerge,
+        unresolved)
 
 
 def findpossible(cmd, table, strict=False):