# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1508006039 -19800 # Node ID 144989dabe93ff24f13ec9bd320baeff3ce099cd # Parent e91ca8b5ecf74dc57917ee747848f546cd39b6c6 stack: show current and unstable also for t0 and bases diff -r e91ca8b5ecf7 -r 144989dabe93 hgext3rd/topic/stack.py --- a/hgext3rd/topic/stack.py Fri Oct 20 12:04:45 2017 +0200 +++ b/hgext3rd/topic/stack.py Sun Oct 15 00:03:59 2017 +0530 @@ -275,26 +275,25 @@ # super crude initial version for idx, isentry, ctx in entries[::-1]: + symbol = None states = [] iscurrentrevision = repo.revs('%d and parents()', ctx.rev()) + if iscurrentrevision: + states.append('current') + symbol = '@' + + if ctx.orphan(): + symbol = '$' + states.append('unstable') + if not isentry: symbol = '^' # "base" is kind of a "ghost" entry - # skip other label for them (no current, no unstable) - states = ['base'] - elif ctx.orphan(): - # current revision can be unstable also, so in that case show both - # the states and the symbol '@' (issue5553) - if iscurrentrevision: - states.append('current') - symbol = '@' - symbol = '$' - states.append('unstable') - elif iscurrentrevision: - states.append('current') - symbol = '@' - else: + states.append('base') + + # none of the above if statments get executed + if not symbol: symbol = ':' states.append('clean') fm.startitem() diff -r e91ca8b5ecf7 -r 144989dabe93 tests/test-topic-stack.t --- a/tests/test-topic-stack.t Fri Oct 20 12:04:45 2017 +0200 +++ b/tests/test-topic-stack.t Sun Oct 15 00:03:59 2017 +0530 @@ -72,7 +72,7 @@ ### topic: other ### target: default (branch) (stack is empty) - t0^ c_b (base) + t0^ c_b (current base) $ hg up foo switching to topic foo @@ -232,7 +232,7 @@ $ hg stack ### target: default (branch) (stack is empty) - b0^ c_f (base) + b0^ c_f (current base) Test "t#" reference ------------------- @@ -424,7 +424,7 @@ ### target: default (branch) t6: c_h t5: c_g - t2^ c_D (base) + t2^ c_D (current base) t4$ c_f (unstable) t3$ c_e (unstable) t2@ c_D (current) @@ -716,7 +716,7 @@ t2$ c_G (unstable) ^ c_F t1$ c_D (current unstable) - t0^ c_C (base) + t0^ c_C (unstable base) more obsolescence @@ -790,7 +790,7 @@ t2$ c_G (unstable) ^ c_F t1$ c_D (current unstable) - t0^ c_C (base) + t0^ c_C (unstable base) Test stack behavior with a split -------------------------------- diff -r e91ca8b5ecf7 -r 144989dabe93 tests/test-topic-tutorial.t --- a/tests/test-topic-tutorial.t Fri Oct 20 12:04:45 2017 +0200 +++ b/tests/test-topic-tutorial.t Sun Oct 15 00:03:59 2017 +0530 @@ -598,7 +598,7 @@ ### topic: food ### target: default (branch) (stack is empty) - t0^ adding fruits (base) + t0^ adding fruits (current base) $ hg log --graph @ changeset: 5:2d50db8b5b4c diff -r e91ca8b5ecf7 -r 144989dabe93 tests/test-topic.t --- a/tests/test-topic.t Fri Oct 20 12:04:45 2017 +0200 +++ b/tests/test-topic.t Sun Oct 15 00:03:59 2017 +0530 @@ -145,7 +145,7 @@ ### topic: narf ### target: default (branch) (stack is empty) - t0^ Add file delta (base) + t0^ Add file delta (current base) Add commits to topic @@ -652,7 +652,7 @@ ### topic: fran ### target: default (branch), ambigious rebase destination - branch 'default' has 2 heads t1: start on fran - t0^ Add file delta (base) + t0^ Add file delta (current base) $ hg topics --age * fran (1970-01-01 by test)