##// END OF EJS Templates
status: extract active-merge state for reuse...
Rodrigo Damazio Bovendorp -
r44390:4ca89cc2 default
parent child Browse files
Show More
@@ -809,12 +809,12 b' class morestatus(object):'
809 reporoot = attr.ib()
809 reporoot = attr.ib()
810 unfinishedop = attr.ib()
810 unfinishedop = attr.ib()
811 unfinishedmsg = attr.ib()
811 unfinishedmsg = attr.ib()
812 inmergestate = attr.ib()
812 activemerge = attr.ib()
813 unresolvedpaths = attr.ib()
813 unresolvedpaths = attr.ib()
814 _label = b'status.morestatus'
814 _label = b'status.morestatus'
815
815
816 def formatfile(self, path, fm):
816 def formatfile(self, path, fm):
817 if self.inmergestate and path in self.unresolvedpaths:
817 if self.activemerge and path in self.unresolvedpaths:
818 fm.data(unresolved=True)
818 fm.data(unresolved=True)
819
819
820 def formatfooter(self, fm):
820 def formatfooter(self, fm):
@@ -838,7 +838,7 b' class morestatus(object):'
838 )
838 )
839
839
840 def _formatconflicts(self, fm):
840 def _formatconflicts(self, fm):
841 if not self.inmergestate:
841 if not self.activemerge:
842 return
842 return
843
843
844 if self.unresolvedpaths:
844 if self.unresolvedpaths:
@@ -868,20 +868,18 b' To mark files as resolved: hg resolve -'
868 def readmorestatus(repo):
868 def readmorestatus(repo):
869 """Returns a morestatus object if the repo has unfinished state."""
869 """Returns a morestatus object if the repo has unfinished state."""
870 statetuple = statemod.getrepostate(repo)
870 statetuple = statemod.getrepostate(repo)
871 mergestate = mergemod.mergestate.read(repo)
872 activemerge = mergestate.active()
871 if not statetuple:
873 if not statetuple:
872 return None
874 return None
873
875
874 unfinishedop, unfinishedmsg = statetuple
876 unfinishedop, unfinishedmsg = statetuple
875 mergestate = mergemod.mergestate.read(repo)
877 mergestate = mergemod.mergestate.read(repo)
876 unresolved = None
878 unresolved = None
877 if mergestate.active():
879 if activemerge:
878 unresolved = sorted(mergestate.unresolved())
880 unresolved = sorted(mergestate.unresolved())
879 return morestatus(
881 return morestatus(
880 repo.root,
882 repo.root, unfinishedop, unfinishedmsg, activemerge, unresolved
881 unfinishedop,
882 unfinishedmsg,
883 unresolved is not None,
884 unresolved,
885 )
883 )
886
884
887
885
General Comments 0
You need to be logged in to leave comments. Login now