Patchwork [2,of,4] mergestate: implement unresolvedcount() in terms of unresolved()

login
register
mail settings
Submitter via Mercurial-devel
Date July 6, 2017, 5:39 p.m.
Message ID <c5cf385ed9f35169e6d5.1499362765@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/22026/
State Accepted
Headers show

Comments

via Mercurial-devel - July 6, 2017, 5:39 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1448990793 28800
#      Tue Dec 01 09:26:33 2015 -0800
# Node ID c5cf385ed9f35169e6d59376e7c3f704ac21d208
# Parent  d4916d8e63be5ef5f3d69d12ad61cffc45a0090c
mergestate: implement unresolvedcount() in terms of unresolved()

This simplifies the method slightly. It does create a full list of
paths while doing so, but it's not a lot of data anyway (besides, I
would think references to strings are no larger than (references to?)
True).

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -568,8 +568,7 @@ 
 
     def unresolvedcount(self):
         """get unresolved count for this merge (persistent)"""
-        return len([True for f, entry in self._state.iteritems()
-                    if entry[0] == 'u'])
+        return len(list(self.unresolved()))
 
     def actions(self):
         """return lists of actions to perform on the dirstate"""