Mercurial > evolve
comparison hgext3rd/topic/stack.py @ 1991:ba79d23594d6
stack: reusing the index number in base when applicable
This clarify the branching when it is easy to track back the branching point.
This does not takes the evolution graph into account yet.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 26 Aug 2016 12:52:06 +0200 |
parents | 71410fa2c253 |
children | 54d6dff699f0 |
comparison
equal
deleted
inserted
replaced
1990:71410fa2c253 | 1991:ba79d23594d6 |
---|---|
16 | 16 |
17 def showstack(ui, repo, topic, opts): | 17 def showstack(ui, repo, topic, opts): |
18 fm = ui.formatter('topicstack', opts) | 18 fm = ui.formatter('topicstack', opts) |
19 prev = None | 19 prev = None |
20 entries = [] | 20 entries = [] |
21 idxmap = {} | |
21 for idx, r in enumerate(getstack(repo, topic), 1): | 22 for idx, r in enumerate(getstack(repo, topic), 1): |
22 ctx = repo[r] | 23 ctx = repo[r] |
23 p1 = ctx.p1() | 24 p1 = ctx.p1() |
24 if p1.obsolete(): | 25 if p1.obsolete(): |
25 p1 = repo[_singlesuccessor(repo, p1)] | 26 p1 = repo[_singlesuccessor(repo, p1)] |
26 if p1.rev() != prev and p1.node() != node.nullid: | 27 if p1.rev() != prev and p1.node() != node.nullid: |
27 entries.append((None, p1)) | 28 entries.append((idxmap.get(p1.rev()), False, p1)) |
28 entries.append((idx, ctx)) | 29 entries.append((idx, True, ctx)) |
30 idxmap[ctx.rev()] = idx | |
29 prev = r | 31 prev = r |
30 | 32 |
31 # super crude initial version | 33 # super crude initial version |
32 for idx, ctx in entries[::-1]: | 34 for idx, isentry, ctx in entries[::-1]: |
33 if idx is None: | 35 if not isentry: |
34 symbol = '^' | 36 symbol = '^' |
35 state = 'base' | 37 state = 'base' |
36 elif repo.revs('%d and parents()', ctx.rev()): | 38 elif repo.revs('%d and parents()', ctx.rev()): |
37 symbol = '@' | 39 symbol = '@' |
38 state = 'current' | 40 state = 'current' |
41 state = 'unstable' | 43 state = 'unstable' |
42 else: | 44 else: |
43 symbol = ':' | 45 symbol = ':' |
44 state = 'clean' | 46 state = 'clean' |
45 fm.startitem() | 47 fm.startitem() |
48 fm.data(isentry=isentry) | |
46 if idx is None: | 49 if idx is None: |
47 fm.plain(' ') | 50 fm.plain(' ') |
48 else: | 51 else: |
49 fm.write('topic.stack.index', 't%d', idx, | 52 fm.write('topic.stack.index', 't%d', idx, |
50 label='topic.stack.index topic.stack.index.%s' % state) | 53 label='topic.stack.index topic.stack.index.%s' % state) |