18 if not topic: |
18 if not topic: |
19 raise error.Abort(_('no active topic to list')) |
19 raise error.Abort(_('no active topic to list')) |
20 fm = ui.formatter('topicstack', opts) |
20 fm = ui.formatter('topicstack', opts) |
21 prev = None |
21 prev = None |
22 for idx, r in enumerate(getstack(repo, topic)): |
22 for idx, r in enumerate(getstack(repo, topic)): |
23 ctx = repo[r] |
23 ctx = repo[r] |
24 p1 = ctx.p1() |
24 p1 = ctx.p1() |
25 if p1.obsolete(): |
25 if p1.obsolete(): |
26 p1 = repo[_singlesuccessor(repo, p1)] |
26 p1 = repo[_singlesuccessor(repo, p1)] |
27 if p1.rev() != prev: |
27 if p1.rev() != prev: |
28 # display the parent of the changeset |
28 # display the parent of the changeset |
29 state = 'base' |
29 state = 'base' |
30 symbol= '_' |
30 symbol = '_' |
31 fm.startitem() |
31 fm.startitem() |
32 fm.plain(' ') # XXX 2 is the right padding by chance |
32 fm.plain(' ') # XXX 2 is the right padding by chance |
33 fm.write('topic.stack.state', '%s', symbol, |
33 fm.write('topic.stack.state', '%s', symbol, |
34 label='topic.stack.state topic.stack.state.%s' % state) |
34 label='topic.stack.state topic.stack.state.%s' % state) |
35 fm.plain(' ') |
35 fm.plain(' ') |
47 if repo.revs('%d and unstable()', r): |
47 if repo.revs('%d and unstable()', r): |
48 symbol = '$' |
48 symbol = '$' |
49 state = 'unstable' |
49 state = 'unstable' |
50 fm.startitem() |
50 fm.startitem() |
51 fm.write('topic.stack.index', 't%d', idx, |
51 fm.write('topic.stack.index', 't%d', idx, |
52 label='topic.stack.index topic.stack.index.%s' % state) |
52 label='topic.stack.index topic.stack.index.%s' % state) |
53 fm.write('topic.stack.state.symbol', '%s', symbol, |
53 fm.write('topic.stack.state.symbol', '%s', symbol, |
54 label='topic.stack.state topic.stack.state.%s' % state) |
54 label='topic.stack.state topic.stack.state.%s' % state) |
55 fm.plain(' ') |
55 fm.plain(' ') |
56 fm.write('topic.stack.desc', '%s', ctx.description().splitlines()[0], |
56 fm.write('topic.stack.desc', '%s', ctx.description().splitlines()[0], |
57 label='topic.stack.desc topic.stack.desc.%s' % state) |
57 label='topic.stack.desc topic.stack.desc.%s' % state) |
58 fm.condwrite(state != 'clean', 'topic.stack.state', ' (%s)', state, |
58 fm.condwrite(state != 'clean', 'topic.stack.state', ' (%s)', state, |
59 label='topic.stack.state topic.stack.state.%s' % state) |
59 label='topic.stack.state topic.stack.state.%s' % state) |
60 fm.plain('\n') |
60 fm.plain('\n') |
61 fm.end() |
61 fm.end() |
62 prev = r |
62 prev = r |
63 |
63 |
64 # Copied from evolve 081605c2e9b6 |
64 # Copied from evolve 081605c2e9b6 |