Patchwork [4,of,7,mergedriver] mergestate: add a function to return the number of unresolved files

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 21, 2015, 1:03 a.m.
Message ID <45f8add0d3082f025c7f.1448067839@dev666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11563/
State Accepted
Commit ca3fbf9dad8c4bcbd1838501efa5cf5e8ac6174a
Delegated to: Martin von Zweigbergk
Headers show

Comments

Siddharth Agarwal - Nov. 21, 2015, 1:03 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1448065131 28800
#      Fri Nov 20 16:18:51 2015 -0800
# Node ID 45f8add0d3082f025c7f3e67b1e28cd78680e72f
# Parent  fa34efec3ea506994c9de30357f68d09aee0f744
# Available At http://42.netv6.net/sid0-wip/hg/
#              hg pull http://42.netv6.net/sid0-wip/hg/ -r 45f8add0d308
mergestate: add a function to return the number of unresolved files

Note that unlike the other functions, this is based on the persistent
mergestate.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -504,6 +504,11 @@  class mergestate(object):
                     merged += 1
         return updated, merged, removed
 
+    def unresolvedcount(self):
+        """get unresolved count for this merge (persistent)"""
+        return len([True for f, entry in self._state.iteritems()
+                    if entry[0] == 'u'])
+
 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
     if f2 is None:
         f2 = f