Patchwork [6,of,7,mergedriver] mergestate: add a method to compute actions to perform on dirstate

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 21, 2015, 1:04 a.m.
Message ID <d3f3222f45eef7acf903.1448067841@dev666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11562/
State Accepted
Commit a88a10a933b2f2c647c91d7c13114777226bcbea
Delegated to: Martin von Zweigbergk
Headers show

Comments

Siddharth Agarwal - Nov. 21, 2015, 1:04 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1448066605 28800
#      Fri Nov 20 16:43:25 2015 -0800
# Node ID d3f3222f45eef7acf90322d4ba5cc9c21f25b7b1
# Parent  9f9a937bb5af83115f1c3349fd2058bb82fe4486
# Available At http://42.netv6.net/sid0-wip/hg/
#              hg pull http://42.netv6.net/sid0-wip/hg/ -r d3f3222f45ee
mergestate: add a method to compute actions to perform on dirstate

We're going to use this to extend the action lists in merge.applyupdates.

The somewhat funky return value is to make passing this dict directly into
recordactions easier. We're going to exploit that in an upcoming patch.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -509,6 +509,14 @@  class mergestate(object):
         return len([True for f, entry in self._state.iteritems()
                     if entry[0] == 'u'])
 
+    def actions(self):
+        """return lists of actions to perform on the dirstate"""
+        actions = {'r': [], 'a': [], 'g': []}
+        for f, (r, action) in self._results.iteritems():
+            if action is not None:
+                actions[action].append((f, None, "merge result"))
+        return actions
+
 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
     if f2 is None:
         f2 = f