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

login
register
mail settings
Submitter timeless
Date May 3, 2016, 4:17 p.m.
Message ID <8b591803219cfcfdae9c.1462292277@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/14869/
State Changes Requested
Delegated to: Augie Fackler
Headers show

Comments

timeless - May 3, 2016, 4:17 p.m.
# HG changeset patch
# User timeless <timeless@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.
Sean Farley - May 4, 2016, 10:24 p.m.
timeless <timeless@fmr.im> writes:

> # HG changeset patch
> # User timeless <timeless@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

Huh. I guess we need to improve the scheme code to inverse map this url?
timeless - May 5, 2016, 2:08 a.m.
Heh, I guess so
On May 4, 2016 6:24 PM, "Sean Farley" <sean@farley.io> wrote:

>
> timeless <timeless@fmr.im> writes:
>
> > # HG changeset patch
> > # User timeless <timeless@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
>
> Huh. I guess we need to improve the scheme code to inverse map this url?
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Augie Fackler - May 5, 2016, 3:24 a.m.
On Tue, May 03, 2016 at 04:17:57PM +0000, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@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

Not sure how I feel about this. Ryan, do you have any thoughts? It
does seem like it'd make the base operator a little more discoverable
for folks...

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

Patch

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