Patchwork [4,of,4,V2] histedit: add an experimental base action

login
register
mail settings
Submitter Mateusz Kwapich
Date Nov. 18, 2015, 1:55 a.m.
Message ID <8a5d433817379070418e.1447811752@mitrandir-mbp1.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/11459/
State Accepted
Delegated to: Augie Fackler
Headers show

Comments

Mateusz Kwapich - Nov. 18, 2015, 1:55 a.m.
# HG changeset patch
# User Mateusz Kwapich <mitrandir@fb.com>
# Date 1447801471 28800
#      Tue Nov 17 15:04:31 2015 -0800
# Node ID 8a5d433817379070418e38e0a345d6e31a413188
# Parent  63635c88adcaa337e7f48bea12aed52a37e7891d
histedit: add an experimental base action

This is a first (very simple) version of the histedit base action.
It works well in common usecases like rebasing the whole stack and
spliting the stack.

I don't see any obvious edge cases - but probably there is more than one.
That's why I want to keep it behind experimental.histeditng config knob
for now. I think on knob for all new histedit behaviors is better because
we will test all of them together and testers will need to turn it on only
once to get all new nice things.
Pierre-Yves David - Nov. 18, 2015, 6:26 p.m.
Augie can you have a look at this?
(Mateusz, can you cc augie on histedit patches?)

On 11/17/2015 05:55 PM, Mateusz Kwapich wrote:
> # HG changeset patch
> # User Mateusz Kwapich <mitrandir@fb.com>
> # Date 1447801471 28800
> #      Tue Nov 17 15:04:31 2015 -0800
> # Node ID 8a5d433817379070418e38e0a345d6e31a413188
> # Parent  63635c88adcaa337e7f48bea12aed52a37e7891d
> histedit: add an experimental base action
>
> This is a first (very simple) version of the histedit base action.
> It works well in common usecases like rebasing the whole stack and
> spliting the stack.
>
> I don't see any obvious edge cases - but probably there is more than one.
> That's why I want to keep it behind experimental.histeditng config knob
> for now. I think on knob for all new histedit behaviors is better because
> we will test all of them together and testers will need to turn it on only
> once to get all new nice things.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -643,6 +643,23 @@
>               replacements.append((ich, (n,)))
>           return repo[n], replacements
>
> +class base(histeditaction):
> +    def constraints(self):
> +        return set(['forceother'])
> +
> +    def run(self):
> +        if self.repo['.'].node() != self.node:
> +            mergemod.update(self.repo, self.node, False, True, False)
> +            #                                     branchmerge, force, partial)
> +        return self.continueclean()
> +
> +    def continuedirty(self):
> +        abortdirty()
> +
> +    def continueclean(self):
> +        basectx = self.repo['.']
> +        return basectx, []
> +
>   class _multifold(fold):
>       """fold subclass used for when multiple folds happen in a row
>
> @@ -1283,3 +1300,5 @@
>       cmdutil.unfinishedstates.append(
>           ['histedit-state', False, True, _('histedit in progress'),
>            _("use 'hg histedit --continue' or 'hg histedit --abort'")])
> +    if ui.configbool("experimental", "histeditng"):
> +        actiontable.update({'b': base, 'base': base})
> diff --git a/tests/test-histedit-base.t b/tests/test-histedit-base.t
> new file mode 100644
> --- /dev/null
> +++ b/tests/test-histedit-base.t
> @@ -0,0 +1,273 @@
> +  $ . "$TESTDIR/histedit-helpers.sh"
> +
> +  $ cat >> $HGRCPATH <<EOF
> +  > [alias]
> +  > tglog = log -G --template "{rev}:{node}:{phase} '{desc}'\n"
> +  > [extensions]
> +  > histedit=
> +  > [experimental]
> +  > histeditng=True
> +  > EOF
> +
> +Create repo a:
> +
> +  $ hg init a
> +  $ cd a
> +  $ hg unbundle "$TESTDIR/bundles/rebase.hg"
> +  adding changesets
> +  adding manifests
> +  adding file changes
> +  added 8 changesets with 7 changes to 7 files (+2 heads)
> +  (run 'hg heads' to see heads, 'hg merge' to merge)
> +  $ hg up tip
> +  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +
> +  $ hg tglog
> +  @  7:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
> +  |
> +  | o  6:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
> +  |/|
> +  o |  5:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
> +  | |
> +  | o  4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
> +  |/
> +  | o  3:32af7686d403cf45b5d95f2d70cebea587ac806a:draft 'D'
> +  | |
> +  | o  2:5fddd98957c8a54a4d436dfe1da9d87f21a1b97b:draft 'C'
> +  | |
> +  | o  1:42ccdea3bb16d28e1848c95fe2e44c000f3f21b1:draft 'B'
> +  |/
> +  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
> +
> +
> +
> +Go to D
> +  $ hg update 3
> +  3 files updated, 0 files merged, 2 files removed, 0 files unresolved
> +edit the history to rebase B onto H
> +
> +
> +Rebase B onto H
> +  $ hg histedit 1 --commands - 2>&1 << EOF | fixbundle
> +  > base 02de42196ebe
> +  > pick 42ccdea3bb16 B
> +  > pick 5fddd98957c8 C
> +  > pick 32af7686d403 D
> +  > EOF
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +
> +  $ hg tglog
> +  @  7:0937e82309df47d14176ee15e45dbec5fbdef340:draft 'D'
> +  |
> +  o  6:f778d1cbddac4ab679d9983c9bb92e4c5e09e7fa:draft 'C'
> +  |
> +  o  5:3d41b7cc708545206213a842f96d812d2e73d818:draft 'B'
> +  |
> +  o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
> +  |
> +  | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
> +  |/|
> +  o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
> +  | |
> +  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
> +  |/
> +  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
> +
> +Rebase back and drop something
> +  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
> +  > base cd010b8cd998
> +  > pick 3d41b7cc7085 B
> +  > drop f778d1cbddac C
> +  > pick 0937e82309df D
> +  > EOF
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +
> +  $ hg tglog
> +  @  6:476cc3e4168da2d036b141f7f7dcff7f8e3fe846:draft 'D'
> +  |
> +  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
> +  |
> +  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
> +  | |
> +  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
> +  | |/|
> +  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
> +  |/ /
> +  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
> +  |/
> +  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
> +
> +Split stack
> +  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
> +  > base cd010b8cd998
> +  > pick d273e35dcdf2 B
> +  > base cd010b8cd998
> +  > pick 476cc3e4168d D
> +  > EOF
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +
> +  $ hg tglog
> +  @  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
> +  |
> +  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
> +  |/
> +  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
> +  | |
> +  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
> +  | |/|
> +  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
> +  |/ /
> +  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
> +  |/
> +  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
> +
> +Abort
> +  $ echo x > B
> +  $ hg add B
> +  $ hg commit -m "X"
> +  $ hg tglog
> +  @  7:591369deedfdcbf57471e894999a70d7f676186d:draft 'X'
> +  |
> +  o  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
> +  |
> +  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
> +  |/
> +  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
> +  | |
> +  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
> +  | |/|
> +  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
> +  |/ /
> +  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
> +  |/
> +  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
> +
> +  $ hg histedit 6 --commands - 2>&1 << EOF | fixbundle
> +  > base d273e35dcdf2 B
> +  > drop d7a6f907a822 D
> +  > pick 591369deedfd X
> +  > EOF
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  merging B
> +  warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
> +  Fix up the change and run hg histedit --continue
> +  $ hg histedit --abort | fixbundle
> +  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  $ hg tglog
> +  @  7:591369deedfdcbf57471e894999a70d7f676186d:draft 'X'
> +  |
> +  o  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
> +  |
> +  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
> +  |/
> +  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
> +  | |
> +  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
> +  | |/|
> +  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
> +  |/ /
> +  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
> +  |/
> +  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
> +
> +Continue
> +  $ hg histedit 6 --commands - 2>&1 << EOF | fixbundle
> +  > base d273e35dcdf2 B
> +  > drop d7a6f907a822 D
> +  > pick 591369deedfd X
> +  > EOF
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  merging B
> +  warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
> +  Fix up the change and run hg histedit --continue
> +  $ echo b2 > B
> +  $ hg resolve --mark B
> +  (no more unresolved files)
> +  $ hg histedit --continue | fixbundle
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  $ hg tglog
> +  @  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
> +  |
> +  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
> +  |
> +  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
> +  | |
> +  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
> +  | |/|
> +  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
> +  |/ /
> +  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
> +  |/
> +  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
> +
> +
> +base on a previously picked changeset
> +  $ echo i > i
> +  $ hg add i
> +  $ hg commit -m "I"
> +  $ echo j > j
> +  $ hg add j
> +  $ hg commit -m "J"
> +  $ hg tglog
> +  @  8:e8c55b19d366b335626e805484110d1d5f6f2ea3:draft 'J'
> +  |
> +  o  7:b2f90fd8aa85db5569e3cfc30cd1d7739546368e:draft 'I'
> +  |
> +  o  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
> +  |
> +  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
> +  |
> +  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
> +  | |
> +  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
> +  | |/|
> +  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
> +  |/ /
> +  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
> +  |/
> +  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
> +
> +  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
> +  > pick d273e35dcdf2 B
> +  > pick 03772da75548 X
> +  > base d273e35dcdf2 B
> +  > pick e8c55b19d366 J
> +  > base d273e35dcdf2 B
> +  > pick b2f90fd8aa85 I
> +  > EOF
> +  abort: may not use "base" with changesets within the edited list
> +
> +  $ hg --config experimental.histeditng=False histedit 5 --commands - 2>&1 << EOF | fixbundle
> +  > base cd010b8cd998 A
> +  > pick d273e35dcdf2 B
> +  > pick 03772da75548 X
> +  > pick b2f90fd8aa85 I
> +  > pick e8c55b19d366 J
> +  > EOF
> +  abort: unknown action "base"
> +
> +  $ hg tglog
> +  @  8:e8c55b19d366b335626e805484110d1d5f6f2ea3:draft 'J'
> +  |
> +  o  7:b2f90fd8aa85db5569e3cfc30cd1d7739546368e:draft 'I'
> +  |
> +  o  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
> +  |
> +  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
> +  |
> +  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
> +  | |
> +  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
> +  | |/|
> +  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
> +  |/ /
> +  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
> +  |/
> +  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
> +
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>
Durham Goode - Nov. 20, 2015, 8:59 p.m.
On 11/17/15 5:55 PM, Mateusz Kwapich wrote:
> # HG changeset patch
> # User Mateusz Kwapich <mitrandir@fb.com>
> # Date 1447801471 28800
> #      Tue Nov 17 15:04:31 2015 -0800
> # Node ID 8a5d433817379070418e38e0a345d6e31a413188
> # Parent  63635c88adcaa337e7f48bea12aed52a37e7891d
> histedit: add an experimental base action
>
> This is a first (very simple) version of the histedit base action.
> It works well in common usecases like rebasing the whole stack and
> spliting the stack.
>
> I don't see any obvious edge cases - but probably there is more than one.
> That's why I want to keep it behind experimental.histeditng config knob
> for now. I think on knob for all new histedit behaviors is better because
> we will test all of them together and testers will need to turn it on only
> once to get all new nice things.
>
Aside from the comments in patch #1, I think the series looks good. I'm 
looking forward to shipping this to our git rebase -i enthusiasts.
Augie Fackler - Nov. 23, 2015, 3:14 p.m.
On Fri, Nov 20, 2015 at 12:59:23PM -0800, Durham Goode wrote:
>
>
> On 11/17/15 5:55 PM, Mateusz Kwapich wrote:
> ># HG changeset patch
> ># User Mateusz Kwapich <mitrandir@fb.com>
> ># Date 1447801471 28800
> >#      Tue Nov 17 15:04:31 2015 -0800
> ># Node ID 8a5d433817379070418e38e0a345d6e31a413188
> ># Parent  63635c88adcaa337e7f48bea12aed52a37e7891d
> >histedit: add an experimental base action
> >
> >This is a first (very simple) version of the histedit base action.
> >It works well in common usecases like rebasing the whole stack and
> >spliting the stack.
> >
> >I don't see any obvious edge cases - but probably there is more than one.
> >That's why I want to keep it behind experimental.histeditng config knob
> >for now. I think on knob for all new histedit behaviors is better because
> >we will test all of them together and testers will need to turn it on only
> >once to get all new nice things.
> >
> Aside from the comments in patch #1, I think the series looks good. I'm
> looking forward to shipping this to our git rebase -i enthusiasts.

Agreed. I fixed the one typo in flight, and I'm doing my own followup
(which I'll just push) to constant-ize the strings.

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Mateusz Kwapich - Nov. 23, 2015, 7:30 p.m.
Great! Constant-ized strings are definitely more safe.

One small question about your patch: is this line necessary at all?
http://hg.netv6.net/clowncopter/rev/6c55dd0268ac#l1.52


Best,
Mateusz





On 11/23/15, 7:14 AM, "Augie Fackler" <raf@durin42.com> wrote:

>On Fri, Nov 20, 2015 at 12:59:23PM -0800, Durham Goode wrote:

>>

>>

>> On 11/17/15 5:55 PM, Mateusz Kwapich wrote:

>> ># HG changeset patch

>> ># User Mateusz Kwapich <mitrandir@fb.com>

>> ># Date 1447801471 28800

>> >#      Tue Nov 17 15:04:31 2015 -0800

>> ># Node ID 8a5d433817379070418e38e0a345d6e31a413188

>> ># Parent  63635c88adcaa337e7f48bea12aed52a37e7891d

>> >histedit: add an experimental base action

>> >

>> >This is a first (very simple) version of the histedit base action.

>> >It works well in common usecases like rebasing the whole stack and

>> >spliting the stack.

>> >

>> >I don't see any obvious edge cases - but probably there is more than one.

>> >That's why I want to keep it behind experimental.histeditng config knob

>> >for now. I think on knob for all new histedit behaviors is better because

>> >we will test all of them together and testers will need to turn it on only

>> >once to get all new nice things.

>> >

>> Aside from the comments in patch #1, I think the series looks good. I'm

>> looking forward to shipping this to our git rebase -i enthusiasts.

>

>Agreed. I fixed the one typo in flight, and I'm doing my own followup

>(which I'll just push) to constant-ize the strings.

>

>> _______________________________________________

>> Mercurial-devel mailing list

>> Mercurial-devel@selenic.com

>> https://selenic.com/mailman/listinfo/mercurial-devel
Augie Fackler - Nov. 23, 2015, 11:36 p.m.
> On Nov 23, 2015, at 2:30 PM, Mateusz Kwapich <mitrandir@fb.com> wrote:
> 
> Great! Constant-ized strings are definitely more safe.
> 
> One small question about your patch: is this line necessary at all?
> http://hg.netv6.net/clowncopter/rev/6c55dd0268ac#l1.52

No, I’m just bad at writing code. :)

(amended and pushed)

> 
> 
> Best,
> Mateusz
> 
> 
> 
> 
> 
> On 11/23/15, 7:14 AM, "Augie Fackler" <raf@durin42.com> wrote:
> 
>> On Fri, Nov 20, 2015 at 12:59:23PM -0800, Durham Goode wrote:
>>> 
>>> 
>>> On 11/17/15 5:55 PM, Mateusz Kwapich wrote:
>>>> # HG changeset patch
>>>> # User Mateusz Kwapich <mitrandir@fb.com>
>>>> # Date 1447801471 28800
>>>> #      Tue Nov 17 15:04:31 2015 -0800
>>>> # Node ID 8a5d433817379070418e38e0a345d6e31a413188
>>>> # Parent  63635c88adcaa337e7f48bea12aed52a37e7891d
>>>> histedit: add an experimental base action
>>>> 
>>>> This is a first (very simple) version of the histedit base action.
>>>> It works well in common usecases like rebasing the whole stack and
>>>> spliting the stack.
>>>> 
>>>> I don't see any obvious edge cases - but probably there is more than one.
>>>> That's why I want to keep it behind experimental.histeditng config knob
>>>> for now. I think on knob for all new histedit behaviors is better because
>>>> we will test all of them together and testers will need to turn it on only
>>>> once to get all new nice things.
>>>> 
>>> Aside from the comments in patch #1, I think the series looks good. I'm
>>> looking forward to shipping this to our git rebase -i enthusiasts.
>> 
>> Agreed. I fixed the one typo in flight, and I'm doing my own followup
>> (which I'll just push) to constant-ize the strings.
>> 
>>> _______________________________________________
>>> Mercurial-devel mailing list
>>> Mercurial-devel@selenic.com
>>> https://selenic.com/mailman/listinfo/mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -643,6 +643,23 @@ 
             replacements.append((ich, (n,)))
         return repo[n], replacements
 
+class base(histeditaction):
+    def constraints(self):
+        return set(['forceother'])
+
+    def run(self):
+        if self.repo['.'].node() != self.node:
+            mergemod.update(self.repo, self.node, False, True, False)
+            #                                     branchmerge, force, partial)
+        return self.continueclean()
+
+    def continuedirty(self):
+        abortdirty()
+
+    def continueclean(self):
+        basectx = self.repo['.']
+        return basectx, []
+
 class _multifold(fold):
     """fold subclass used for when multiple folds happen in a row
 
@@ -1283,3 +1300,5 @@ 
     cmdutil.unfinishedstates.append(
         ['histedit-state', False, True, _('histedit in progress'),
          _("use 'hg histedit --continue' or 'hg histedit --abort'")])
+    if ui.configbool("experimental", "histeditng"):
+        actiontable.update({'b': base, 'base': base})
diff --git a/tests/test-histedit-base.t b/tests/test-histedit-base.t
new file mode 100644
--- /dev/null
+++ b/tests/test-histedit-base.t
@@ -0,0 +1,273 @@ 
+  $ . "$TESTDIR/histedit-helpers.sh"
+
+  $ cat >> $HGRCPATH <<EOF
+  > [alias]
+  > tglog = log -G --template "{rev}:{node}:{phase} '{desc}'\n"
+  > [extensions]
+  > histedit=
+  > [experimental]
+  > histeditng=True
+  > EOF
+
+Create repo a:
+
+  $ hg init a
+  $ cd a
+  $ hg unbundle "$TESTDIR/bundles/rebase.hg"
+  adding changesets
+  adding manifests
+  adding file changes
+  added 8 changesets with 7 changes to 7 files (+2 heads)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+  $ hg up tip
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg tglog
+  @  7:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
+  |
+  | o  6:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
+  |/|
+  o |  5:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
+  | |
+  | o  4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
+  |/
+  | o  3:32af7686d403cf45b5d95f2d70cebea587ac806a:draft 'D'
+  | |
+  | o  2:5fddd98957c8a54a4d436dfe1da9d87f21a1b97b:draft 'C'
+  | |
+  | o  1:42ccdea3bb16d28e1848c95fe2e44c000f3f21b1:draft 'B'
+  |/
+  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
+  
+
+
+Go to D
+  $ hg update 3
+  3 files updated, 0 files merged, 2 files removed, 0 files unresolved
+edit the history to rebase B onto H
+
+
+Rebase B onto H
+  $ hg histedit 1 --commands - 2>&1 << EOF | fixbundle
+  > base 02de42196ebe
+  > pick 42ccdea3bb16 B
+  > pick 5fddd98957c8 C
+  > pick 32af7686d403 D
+  > EOF
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg tglog
+  @  7:0937e82309df47d14176ee15e45dbec5fbdef340:draft 'D'
+  |
+  o  6:f778d1cbddac4ab679d9983c9bb92e4c5e09e7fa:draft 'C'
+  |
+  o  5:3d41b7cc708545206213a842f96d812d2e73d818:draft 'B'
+  |
+  o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
+  |
+  | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
+  |/|
+  o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
+  | |
+  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
+  |/
+  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
+  
+Rebase back and drop something
+  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
+  > base cd010b8cd998
+  > pick 3d41b7cc7085 B
+  > drop f778d1cbddac C
+  > pick 0937e82309df D
+  > EOF
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg tglog
+  @  6:476cc3e4168da2d036b141f7f7dcff7f8e3fe846:draft 'D'
+  |
+  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
+  |
+  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
+  | |
+  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
+  | |/|
+  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
+  |/ /
+  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
+  |/
+  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
+  
+Split stack
+  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
+  > base cd010b8cd998
+  > pick d273e35dcdf2 B
+  > base cd010b8cd998
+  > pick 476cc3e4168d D
+  > EOF
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg tglog
+  @  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
+  |
+  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
+  |/
+  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
+  | |
+  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
+  | |/|
+  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
+  |/ /
+  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
+  |/
+  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
+  
+Abort
+  $ echo x > B
+  $ hg add B
+  $ hg commit -m "X"
+  $ hg tglog
+  @  7:591369deedfdcbf57471e894999a70d7f676186d:draft 'X'
+  |
+  o  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
+  |
+  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
+  |/
+  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
+  | |
+  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
+  | |/|
+  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
+  |/ /
+  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
+  |/
+  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
+  
+  $ hg histedit 6 --commands - 2>&1 << EOF | fixbundle
+  > base d273e35dcdf2 B
+  > drop d7a6f907a822 D
+  > pick 591369deedfd X
+  > EOF
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merging B
+  warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
+  Fix up the change and run hg histedit --continue
+  $ hg histedit --abort | fixbundle
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg tglog
+  @  7:591369deedfdcbf57471e894999a70d7f676186d:draft 'X'
+  |
+  o  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
+  |
+  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
+  |/
+  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
+  | |
+  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
+  | |/|
+  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
+  |/ /
+  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
+  |/
+  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
+  
+Continue
+  $ hg histedit 6 --commands - 2>&1 << EOF | fixbundle
+  > base d273e35dcdf2 B
+  > drop d7a6f907a822 D
+  > pick 591369deedfd X
+  > EOF
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merging B
+  warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
+  Fix up the change and run hg histedit --continue
+  $ echo b2 > B
+  $ hg resolve --mark B
+  (no more unresolved files)
+  $ hg histedit --continue | fixbundle
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg tglog
+  @  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
+  |
+  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
+  |
+  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
+  | |
+  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
+  | |/|
+  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
+  |/ /
+  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
+  |/
+  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
+  
+
+base on a previously picked changeset
+  $ echo i > i
+  $ hg add i
+  $ hg commit -m "I"
+  $ echo j > j
+  $ hg add j
+  $ hg commit -m "J"
+  $ hg tglog
+  @  8:e8c55b19d366b335626e805484110d1d5f6f2ea3:draft 'J'
+  |
+  o  7:b2f90fd8aa85db5569e3cfc30cd1d7739546368e:draft 'I'
+  |
+  o  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
+  |
+  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
+  |
+  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
+  | |
+  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
+  | |/|
+  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
+  |/ /
+  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
+  |/
+  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
+  
+  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
+  > pick d273e35dcdf2 B
+  > pick 03772da75548 X
+  > base d273e35dcdf2 B
+  > pick e8c55b19d366 J
+  > base d273e35dcdf2 B
+  > pick b2f90fd8aa85 I
+  > EOF
+  abort: may not use "base" with changesets within the edited list
+
+  $ hg --config experimental.histeditng=False histedit 5 --commands - 2>&1 << EOF | fixbundle
+  > base cd010b8cd998 A
+  > pick d273e35dcdf2 B
+  > pick 03772da75548 X
+  > pick b2f90fd8aa85 I
+  > pick e8c55b19d366 J
+  > EOF
+  abort: unknown action "base"
+
+  $ hg tglog
+  @  8:e8c55b19d366b335626e805484110d1d5f6f2ea3:draft 'J'
+  |
+  o  7:b2f90fd8aa85db5569e3cfc30cd1d7739546368e:draft 'I'
+  |
+  o  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
+  |
+  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
+  |
+  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
+  | |
+  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
+  | |/|
+  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
+  |/ /
+  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
+  |/
+  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
+