[Updated] [+ ] D8565: mergestate: optimize unresolvedcount() a little bit
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Thu May 28 20:26:52 UTC 2020
durin42 updated this revision to Diff 21510.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8565?vs=21442&id=21510
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8565/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8565
AFFECTED FILES
mercurial/mergestate.py
CHANGE DETAILS
diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -85,6 +85,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
@@ -575,10 +581,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):
@@ -713,7 +716,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"""
To: durin42, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200528/18ee581a/attachment-0002.html>
More information about the Mercurial-patches
mailing list