# HG changeset patch
# User Martin von Zweigbergk <martinv...@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).

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"""
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to