D2396: stack: import Evolve stack test file

2018-04-05 Thread lothiraldan (Boris Feld)
lothiraldan marked 3 inline comments as done.
lothiraldan added inline comments.

INLINE COMMENTS

> yuja wrote in revset.py:1549
> This breaks the order of `tip:0 & stack()` for example, and is moot
> since 
> https://phab.mercurial-scm.org/rHG68fcc5503ec55bda2d6be2887f8fc3f61000c666, 
> which makes stacks follow the standard order.

I have send a follow-up https://phab.mercurial-scm.org/D3136

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2396

To: lothiraldan, #hg-reviewers, indygreg
Cc: martinvonz, yuja, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2396: stack: import Evolve stack test file

2018-04-05 Thread lothiraldan (Boris Feld)
lothiraldan added inline comments.

INLINE COMMENTS

> martinvonz wrote in test-stack.t:96-108
> I think I would have preferred to see all of these in my stack rather than 
> just commit 6. Would you?

The goal of this series is to define a clean stack definition API. We started 
by reusing the existing bits from histsedit and show stack.

I've added a first way to configure the stack definition through configuration. 
I think seeing all the drafts is a good idea and we will works in a later 
series to have a way to include them in the stack.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2396

To: lothiraldan, #hg-reviewers, indygreg
Cc: martinvonz, yuja, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2396: stack: import Evolve stack test file

2018-03-21 Thread yuja (Yuya Nishihara)
yuja added inline comments.

INLINE COMMENTS

> revset.py:1549
> +# Force to use the order of the stacks instead of the subset one
> +return stacks & subset
> +

This breaks the order of `tip:0 & stack()` for example, and is moot
since 
https://phab.mercurial-scm.org/rHG68fcc5503ec55bda2d6be2887f8fc3f61000c666, 
which makes stacks follow the standard order.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2396

To: lothiraldan, #hg-reviewers, indygreg
Cc: martinvonz, yuja, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2396: stack: import Evolve stack test file

2018-03-21 Thread yuja (Yuya Nishihara)
yuja added inline comments.

INLINE COMMENTS

> indygreg wrote in revset.py:1534
> I'm not sure if the predicate should be prefixed with an underscore to mark 
> it as internal. My reading of the help code is that the lack of a docstring 
> will hide it from the docs.
> 
> I /think/ this is OK. But I wouldn't be surprised if @yuja or someone told me 
> it needs changed. I'll queue this for now. We can always fix it up later if 
> it is a problem.

If it's internal (i.e. shouldn't be accessible by user), `_stack()` is 
preferred.
If it's just experimental, it can be hidden by "(EXPERIMENTAL)"
in docstring.

> revset.py:1541
> +if x is None:
> +stacks = stack.getstack(repo, x)
> +else:

Nit: I prefer `stackmod.` and name the revset function as `stack()`.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2396

To: lothiraldan, #hg-reviewers, indygreg
Cc: martinvonz, yuja, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2396: stack: import Evolve stack test file

2018-03-20 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> test-stack.t:81
> +  |
> +  o  3 foo draft c_d
> +  |

What if this was @ in the hg repo and only commits 4 and 5 were my own, then I 
would not want it to be part of my stack. It feels like a definition of 
upstream would be very helpful. Perhaps a way of providing a separate upstream 
per commit would be useful. Let's say upstream() was a revset, then I feel like 
something like "only(., upstream(.))" would be my stack. Of course, it gets 
weird if I have a history like we have here and I have defined the upstream of 
4 to be 2 and the upstream of 5 to be 3 (or the other way around). I guess only 
commits that share an upstream can be part of the same stack.

> test-stack.t:96-108
> +  @  6 foo draft c_d
> +  |
> +  | *  5 foo draft c_f
> +  | |
> +  | *  4 foo draft c_e
> +  | |
> +  | x  3 foo draft c_d

I think I would have preferred to see all of these in my stack rather than just 
commit 6. Would you?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2396

To: lothiraldan, #hg-reviewers, indygreg
Cc: martinvonz, yuja, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2396: stack: import Evolve stack test file

2018-03-19 Thread lothiraldan (Boris Feld)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG407934a97bc7: stack: import Evolve stack test file 
(authored by lothiraldan, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D2396?vs=6213=7125#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2396?vs=6213=7125

REVISION DETAIL
  https://phab.mercurial-scm.org/D2396

AFFECTED FILES
  mercurial/revset.py
  tests/test-stack.t

CHANGE DETAILS

diff --git a/tests/test-stack.t b/tests/test-stack.t
new file mode 100644
--- /dev/null
+++ b/tests/test-stack.t
@@ -0,0 +1,253 @@
+
+This test test the low-level definition of stack, agnostic from all formatting
+
+Initial setup
+
+  $ cat << EOF >> $HGRCPATH
+  > [ui]
+  > logtemplate = {rev} {branch} {phase} {desc|firstline}\n
+  > [extensions]
+  > rebase=
+  > [experimental]
+  > evolution=createmarkers,exchange,allowunstable
+  > EOF
+
+  $ hg init main
+  $ cd main
+  $ hg branch other
+  marked working directory as branch other
+  (branches are permanent and global, did you want a bookmark?)
+  $ echo aaa > aaa
+  $ hg add aaa
+  $ hg commit -m c_a
+  $ echo aaa > bbb
+  $ hg add bbb
+  $ hg commit -m c_b
+  $ hg branch foo
+  marked working directory as branch foo
+  $ echo aaa > ccc
+  $ hg add ccc
+  $ hg commit -m c_c
+  $ echo aaa > ddd
+  $ hg add ddd
+  $ hg commit -m c_d
+  $ echo aaa > eee
+  $ hg add eee
+  $ hg commit -m c_e
+  $ echo aaa > fff
+  $ hg add fff
+  $ hg commit -m c_f
+  $ hg log -G
+  @  5 foo draft c_f
+  |
+  o  4 foo draft c_e
+  |
+  o  3 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  o  1 other draft c_b
+  |
+  o  0 other draft c_a
+  
+
+Check that stack doesn't include public changesets
+--
+
+  $ hg up other
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ hg log -G -r "stack()"
+  @  1 other draft c_b
+  |
+  o  0 other draft c_a
+  
+  $ hg phase --public 'branch("other")'
+  $ hg log -G -r "stack()"
+  $ hg up foo
+  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Simple test
+---
+
+'stack()' list all changeset in the branch
+
+  $ hg branch
+  foo
+  $ hg log -G -r "stack()"
+  @  5 foo draft c_f
+  |
+  o  4 foo draft c_e
+  |
+  o  3 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  ~
+
+Case with some of the branch unstable
+
+
+  $ hg up 3
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo bbb > ddd
+  $ hg commit --amend
+  2 new orphan changesets
+  $ hg log -G
+  @  6 foo draft c_d
+  |
+  | *  5 foo draft c_f
+  | |
+  | *  4 foo draft c_e
+  | |
+  | x  3 foo draft c_d
+  |/
+  o  2 foo draft c_c
+  |
+  o  1 other public c_b
+  |
+  o  0 other public c_a
+  
+  $ hg log -G -r "stack()"
+  @  6 foo draft c_d
+  |
+  ~
+  $ hg up -r "desc(c_e)"
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log -G -r "stack()"
+  @  4 foo draft c_e
+  |
+  x  3 foo draft c_d
+  |
+  ~
+  $ hg up -r "desc(c_d)"
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg log -G -r "stack()"
+  @  6 foo draft c_d
+  |
+  ~
+
+Case with multiple topological heads
+
+
+Make things linear again
+
+  $ hg rebase -s 'desc(c_e)' -d 'desc(c_d) - obsolete()'
+  rebasing 4:4f2a69f6d380 "c_e"
+  rebasing 5:913c298d8b0a "c_f"
+  $ hg log -G
+  o  8 foo draft c_f
+  |
+  o  7 foo draft c_e
+  |
+  @  6 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  o  1 other public c_b
+  |
+  o  0 other public c_a
+  
+
+Create the second branch
+
+  $ hg up 'desc(c_d)'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo aaa > ggg
+  $ hg add ggg
+  $ hg commit -m c_g
+  created new head
+  $ echo aaa > hhh
+  $ hg add hhh
+  $ hg commit -m c_h
+  $ hg log -G
+  @  10 foo draft c_h
+  |
+  o  9 foo draft c_g
+  |
+  | o  8 foo draft c_f
+  | |
+  | o  7 foo draft c_e
+  |/
+  o  6 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  o  1 other public c_b
+  |
+  o  0 other public c_a
+  
+
+Test output
+
+  $ hg log -G -r "stack(10)"
+  @  10 foo draft c_h
+  |
+  o  9 foo draft c_g
+  |
+  ~
+  $ hg log -G -r "stack(8)"
+  o  8 foo draft c_f
+  |
+  o  7 foo draft c_e
+  |
+  ~
+  $ hg log -G -r "stack(head())"
+  @  10 foo draft c_h
+  |
+  o  9 foo draft c_g
+  |
+  ~
+  o  8 foo draft c_f
+  |
+  o  7 foo draft c_e
+  |
+  ~
+Check the stack order
+  $ hg log -r "first(stack())"
+  10 foo draft c_h
+  $ hg log -r "first(stack(10))"
+  10 foo draft c_h
+  $ hg log -r "first(stack(8))"
+  8 foo draft c_f
+  $ hg log -r "first(stack(head()))"
+  8 foo draft c_f
+
+Case with multiple heads with unstability involved
+--
+
+We amend the message to make sure the display base pick the right changeset
+
+  $ hg up 'desc(c_d)'
+  0 files updated, 0 files merged, 2 

D2396: stack: import Evolve stack test file

2018-03-19 Thread indygreg (Gregory Szorc)
indygreg accepted this revision.
indygreg added a subscriber: yuja.
indygreg added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> revset.py:1534
>  
> +@predicate('stack([revs])', safe=True)
> +def _stack(repo, subset, x):

I'm not sure if the predicate should be prefixed with an underscore to mark it 
as internal. My reading of the help code is that the lack of a docstring will 
hide it from the docs.

I /think/ this is OK. But I wouldn't be surprised if @yuja or someone told me 
it needs changed. I'll queue this for now. We can always fix it up later if it 
is a problem.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2396

To: lothiraldan, #hg-reviewers, indygreg
Cc: yuja, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2396: stack: import Evolve stack test file

2018-02-28 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 6213.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2396?vs=6010=6213

REVISION DETAIL
  https://phab.mercurial-scm.org/D2396

AFFECTED FILES
  mercurial/revset.py
  tests/test-stack.t

CHANGE DETAILS

diff --git a/tests/test-stack.t b/tests/test-stack.t
new file mode 100644
--- /dev/null
+++ b/tests/test-stack.t
@@ -0,0 +1,253 @@
+
+This test test the low-level definition of stack, agnostic from all formatting
+
+Initial setup
+
+  $ cat << EOF >> $HGRCPATH
+  > [ui]
+  > logtemplate = {rev} {branch} {phase} {desc|firstline}\n
+  > [extensions]
+  > rebase=
+  > [experimental]
+  > evolution=createmarkers,exchange,allowunstable
+  > EOF
+
+  $ hg init main
+  $ cd main
+  $ hg branch other
+  marked working directory as branch other
+  (branches are permanent and global, did you want a bookmark?)
+  $ echo aaa > aaa
+  $ hg add aaa
+  $ hg commit -m c_a
+  $ echo aaa > bbb
+  $ hg add bbb
+  $ hg commit -m c_b
+  $ hg branch foo
+  marked working directory as branch foo
+  $ echo aaa > ccc
+  $ hg add ccc
+  $ hg commit -m c_c
+  $ echo aaa > ddd
+  $ hg add ddd
+  $ hg commit -m c_d
+  $ echo aaa > eee
+  $ hg add eee
+  $ hg commit -m c_e
+  $ echo aaa > fff
+  $ hg add fff
+  $ hg commit -m c_f
+  $ hg log -G
+  @  5 foo draft c_f
+  |
+  o  4 foo draft c_e
+  |
+  o  3 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  o  1 other draft c_b
+  |
+  o  0 other draft c_a
+  
+
+Check that stack doesn't include public changesets
+--
+
+  $ hg up other
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ hg log -G -r "stack()"
+  @  1 other draft c_b
+  |
+  o  0 other draft c_a
+  
+  $ hg phase --public 'branch("other")'
+  $ hg log -G -r "stack()"
+  $ hg up foo
+  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Simple test
+---
+
+'stack()' list all changeset in the branch
+
+  $ hg branch
+  foo
+  $ hg log -G -r "stack()"
+  @  5 foo draft c_f
+  |
+  o  4 foo draft c_e
+  |
+  o  3 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  ~
+
+Case with some of the branch unstable
+
+
+  $ hg up 3
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo bbb > ddd
+  $ hg commit --amend
+  2 new orphan changesets
+  $ hg log -G
+  @  6 foo draft c_d
+  |
+  | *  5 foo draft c_f
+  | |
+  | *  4 foo draft c_e
+  | |
+  | x  3 foo draft c_d
+  |/
+  o  2 foo draft c_c
+  |
+  o  1 other public c_b
+  |
+  o  0 other public c_a
+  
+  $ hg log -G -r "stack()"
+  @  6 foo draft c_d
+  |
+  ~
+  $ hg up -r "desc(c_e)"
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log -G -r "stack()"
+  @  4 foo draft c_e
+  |
+  x  3 foo draft c_d
+  |
+  ~
+  $ hg up -r "desc(c_d)"
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg log -G -r "stack()"
+  @  6 foo draft c_d
+  |
+  ~
+
+Case with multiple topological heads
+
+
+Make things linear again
+
+  $ hg rebase -s 'desc(c_e)' -d 'desc(c_d) - obsolete()'
+  rebasing 4:4f2a69f6d380 "c_e"
+  rebasing 5:913c298d8b0a "c_f"
+  $ hg log -G
+  o  8 foo draft c_f
+  |
+  o  7 foo draft c_e
+  |
+  @  6 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  o  1 other public c_b
+  |
+  o  0 other public c_a
+  
+
+Create the second branch
+
+  $ hg up 'desc(c_d)'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo aaa > ggg
+  $ hg add ggg
+  $ hg commit -m c_g
+  created new head
+  $ echo aaa > hhh
+  $ hg add hhh
+  $ hg commit -m c_h
+  $ hg log -G
+  @  10 foo draft c_h
+  |
+  o  9 foo draft c_g
+  |
+  | o  8 foo draft c_f
+  | |
+  | o  7 foo draft c_e
+  |/
+  o  6 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  o  1 other public c_b
+  |
+  o  0 other public c_a
+  
+
+Test output
+
+  $ hg log -G -r "stack(10)"
+  @  10 foo draft c_h
+  |
+  o  9 foo draft c_g
+  |
+  ~
+  $ hg log -G -r "stack(8)"
+  o  8 foo draft c_f
+  |
+  o  7 foo draft c_e
+  |
+  ~
+  $ hg log -G -r "stack(head())"
+  @  10 foo draft c_h
+  |
+  o  9 foo draft c_g
+  |
+  ~
+  o  8 foo draft c_f
+  |
+  o  7 foo draft c_e
+  |
+  ~
+Check the stack order
+  $ hg log -r "first(stack())"
+  10 foo draft c_h
+  $ hg log -r "first(stack(10))"
+  10 foo draft c_h
+  $ hg log -r "first(stack(8))"
+  8 foo draft c_f
+  $ hg log -r "first(stack(head()))"
+  8 foo draft c_f
+
+Case with multiple heads with unstability involved
+--
+
+We amend the message to make sure the display base pick the right changeset
+
+  $ hg up 'desc(c_d)'
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo ccc > ddd
+  $ hg commit --amend -m 'c_D'
+  4 new orphan changesets
+  $ hg rebase -d . -s 'desc(c_g)'
+  rebasing 9:2ebb6e48ab8a "c_g"
+  rebasing 10:634f38e27a1d "c_h"
+  $ hg 

D2396: stack: import Evolve stack test file

2018-02-23 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  I haven't looked at the remainder of the series, but it feels weird to 
basically reinvent a special case of `hg log` as a debug command. I do see 
there is a commit introducing a revset for `stack`. Perhaps we could move it up 
in the series so we don't need what might be a not-very-useful debug command?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2396

To: lothiraldan, #hg-reviewers
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2396: stack: import Evolve stack test file

2018-02-23 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Import Evolve stack test file for starting to have good coverage on stack
  definition.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2396

AFFECTED FILES
  mercurial/debugcommands.py
  tests/test-completion.t
  tests/test-help.t
  tests/test-stack.t

CHANGE DETAILS

diff --git a/tests/test-stack.t b/tests/test-stack.t
new file mode 100644
--- /dev/null
+++ b/tests/test-stack.t
@@ -0,0 +1,213 @@
+
+This test test the low-level definition of stack, agnostic from all formatting
+
+Initial setup
+
+  $ cat << EOF >> $HGRCPATH
+  > [ui]
+  > logtemplate = {rev} {branch} {phase} {desc|firstline}\n
+  > [extensions]
+  > rebase=
+  > [experimental]
+  > evolution=createmarkers,exchange,allowunstable
+  > EOF
+
+  $ hg init main
+  $ cd main
+  $ hg branch other
+  marked working directory as branch other
+  (branches are permanent and global, did you want a bookmark?)
+  $ echo aaa > aaa
+  $ hg add aaa
+  $ hg commit -m c_a
+  $ echo aaa > bbb
+  $ hg add bbb
+  $ hg commit -m c_b
+  $ hg branch foo
+  marked working directory as branch foo
+  $ echo aaa > ccc
+  $ hg add ccc
+  $ hg commit -m c_c
+  $ echo aaa > ddd
+  $ hg add ddd
+  $ hg commit -m c_d
+  $ echo aaa > eee
+  $ hg add eee
+  $ hg commit -m c_e
+  $ echo aaa > fff
+  $ hg add fff
+  $ hg commit -m c_f
+  $ hg log -G
+  @  5 foo draft c_f
+  |
+  o  4 foo draft c_e
+  |
+  o  3 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  o  1 other draft c_b
+  |
+  o  0 other draft c_a
+  
+
+Check that stack doesn't include public changesets
+--
+
+  $ hg up other
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ hg debugstack
+  1
+  0
+  $ hg phase --public 'branch("other")'
+  $ hg debugstack
+  $ hg up foo
+  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Simple test
+---
+
+'hg debugstack' list all changeset in the branch
+
+  $ hg branch
+  foo
+  $ hg debugstack
+  5
+  4
+  3
+  2
+
+Case with some of the branch unstable
+
+
+  $ hg up 3
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo bbb > ddd
+  $ hg commit --amend
+  2 new orphan changesets
+  $ hg log -G
+  @  6 foo draft c_d
+  |
+  | *  5 foo draft c_f
+  | |
+  | *  4 foo draft c_e
+  | |
+  | x  3 foo draft c_d
+  |/
+  o  2 foo draft c_c
+  |
+  o  1 other public c_b
+  |
+  o  0 other public c_a
+  
+  $ hg debugstack
+  6
+  $ hg up -r "desc(c_e)"
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg debugstack
+  4
+  3
+  $ hg up -r "desc(c_d)"
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg debugstack
+  6
+
+Case with multiple topological heads
+
+
+Make things linear again
+
+  $ hg rebase -s 'desc(c_e)' -d 'desc(c_d) - obsolete()'
+  rebasing 4:4f2a69f6d380 "c_e"
+  rebasing 5:913c298d8b0a "c_f"
+  $ hg log -G
+  o  8 foo draft c_f
+  |
+  o  7 foo draft c_e
+  |
+  @  6 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  o  1 other public c_b
+  |
+  o  0 other public c_a
+  
+
+Create the second branch
+
+  $ hg up 'desc(c_d)'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo aaa > ggg
+  $ hg add ggg
+  $ hg commit -m c_g
+  created new head
+  $ echo aaa > hhh
+  $ hg add hhh
+  $ hg commit -m c_h
+  $ hg log -G
+  @  10 foo draft c_h
+  |
+  o  9 foo draft c_g
+  |
+  | o  8 foo draft c_f
+  | |
+  | o  7 foo draft c_e
+  |/
+  o  6 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  o  1 other public c_b
+  |
+  o  0 other public c_a
+  
+
+Test output
+
+  $ hg debugstack
+  10
+  9
+  $ hg up 'desc(c_f)'
+  2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ hg debugstack
+  8
+  7
+
+Case with multiple heads with unstability involved
+--
+
+We amend the message to make sure the display base pick the right changeset
+
+  $ hg up 'desc(c_d)'
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo ccc > ddd
+  $ hg commit --amend -m 'c_D'
+  4 new orphan changesets
+  $ hg rebase -d . -s 'desc(c_g)'
+  rebasing 9:2ebb6e48ab8a "c_g"
+  rebasing 10:634f38e27a1d "c_h"
+  $ hg log -G
+  o  13 foo draft c_h
+  |
+  o  12 foo draft c_g
+  |
+  @  11 foo draft c_D
+  |
+  | *  8 foo draft c_f
+  | |
+  | *  7 foo draft c_e
+  | |
+  | x  6 foo draft c_d
+  |/
+  o  2 foo draft c_c
+  |
+  o  1 other public c_b
+  |
+  o  0 other public c_a
+  
+
+We should improve stack definition to also show 12 and 13 here
+  $ hg debugstack
+  11
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -970,6 +970,7 @@
debugsetparents
  manually set the parents of the