diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py --- a/mercurial/mergestate.py +++ b/mercurial/mergestate.py @@ -86,6 +86,12 @@ ACTION_GET_OTHER_AND_STORE = b'gs' +_MERGE_UNRESOLVED_STATES = { + MERGE_RECORD_UNRESOLVED, + MERGE_RECORD_UNRESOLVED_PATH, +} + + class mergestate(object): '''track 3-way merge state of individual files @@ -576,10 +582,7 @@ """Obtain the paths of unresolved files.""" for f, entry in pycompat.iteritems(self._state): - if entry[0] in ( - MERGE_RECORD_UNRESOLVED, - MERGE_RECORD_UNRESOLVED_PATH, - ): + if entry[0] in _MERGE_UNRESOLVED_STATES: yield f def driverresolved(self): @@ -714,7 +717,13 @@ def unresolvedcount(self): """get unresolved count for this merge (persistent)""" - return len(list(self.unresolved())) + return len( + [ + None + for entry in pycompat.itervalues(self._state) + if entry[0] in _MERGE_UNRESOLVED_STATES + ] + ) def actions(self): """return lists of actions to perform on the dirstate"""