[PATCH 3 of 3 v2] histedit: add implicit base to default plan

timeless timeless at fmr.im
Tue May 3 16:17:57 UTC 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1462289414 0
#      Tue May 03 15:30:14 2016 +0000
# Node ID 8b591803219cfcfdae9c878a6237f9e22e452544
# Parent  69374882b37156b87eea935feeaa696235abf204
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r 8b591803219c
histedit: add implicit base to default plan

With experimental.histeditng, there is a base command,
in order to faciliate its use, list the implicit base
in the default plan.

diff -r 69374882b371 -r 8b591803219c hgext/histedit.py
--- a/hgext/histedit.py	Tue May 03 16:15:41 2016 +0000
+++ b/hgext/histedit.py	Tue May 03 15:30:14 2016 +0000
@@ -813,6 +813,23 @@
         basectx = self.repo['.']
         return basectx, []
 
+    @classmethod
+    def initialactions(cls, state, actions):
+        """insert the implicit base into the action list
+
+        Base lets one set the target for the next action.
+        It's helpful to know what that base is, in case you
+        are trying to split some commits to that base.
+        Also, by showing the action in the plan, it's easier
+        for users to understand how to use it."""
+        if not actions:
+            return actions
+        act = actions[0]
+        if not isinstance(act, pick):
+            return actions
+        act = cls(state, state.repo[act.node].parents()[0])
+        return [act] + actions
+
 @action(['_multifold'],
         _(
     """fold subclass used for when multiple folds happen in a row
diff -r 69374882b371 -r 8b591803219c tests/test-histedit-base.t
--- a/tests/test-histedit-base.t	Tue May 03 16:15:41 2016 +0000
+++ b/tests/test-histedit-base.t	Tue May 03 15:30:14 2016 +0000
@@ -42,6 +42,7 @@
 Verify that implicit base command and help are listed
 
   $ HGEDITOR=cat hg histedit |grep base
+  base 24b6387c8c8c 5 F
   #  b, base = checkout changeset and apply further changesets from there
 
 Go to D



More information about the Mercurial-devel mailing list