D7667: status: extract active-merge state for reuse

rdamazio (Rodrigo Damazio Bovendorp) phabricator at mercurial-scm.org
Thu Dec 19 12:56:27 EST 2019


Closed by commit rHG4ca89cc20d02: status: extract active-merge state for reuse (authored by rdamazio).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D7667?vs=18875&id=18879#toc

REPOSITORY
  rHG Mercurial

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

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

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -809,12 +809,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):
@@ -838,7 +838,7 @@
             )
 
     def _formatconflicts(self, fm):
-        if not self.inmergestate:
+        if not self.activemerge:
             return
 
         if self.unresolvedpaths:
@@ -868,20 +868,18 @@
 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,
+        repo.root, unfinishedop, unfinishedmsg, activemerge, unresolved
     )
 
 



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


More information about the Mercurial-devel mailing list