# HG changeset patch # User Pierre-Yves David # Date 1472216158 -7200 # Node ID ce86f7bb4b7bdb47099273fca66812929ad0f9e0 # Parent 5c40dd2cf13154a0dcaea449fc67a324ed6d507c stack: add some behind information This is the next useful thing after branch diff -r 5c40dd2cf131 -r ce86f7bb4b7b hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Fri Aug 26 14:23:31 2016 +0200 +++ b/hgext3rd/topic/__init__.py Fri Aug 26 14:55:58 2016 +0200 @@ -58,6 +58,8 @@ 'topic.stack.state.current': 'cyan bold', # random pick 'topic.stack.desc.current': 'cyan', # random pick 'topic.stack.state.unstable': 'red', + 'topic.stack.summary.behindcount': 'cyan', + 'topic.stack.summary.behinderror': 'red', } testedwith = '3.9' diff -r 5c40dd2cf131 -r ce86f7bb4b7b hgext3rd/topic/stack.py --- a/hgext3rd/topic/stack.py Fri Aug 26 14:23:31 2016 +0200 +++ b/hgext3rd/topic/stack.py Fri Aug 26 14:55:58 2016 +0200 @@ -28,9 +28,16 @@ data = stackdata(repo, topic) fm.plain(_('### topic: %s\n') % ui.label(topic, label), label='topic.stack.summary.topic') - fm.plain(_('### branch: %s\n') + fm.plain(_('### branch: %s') % '+'.join(data['branches']), # XXX handle multi branches label='topic.stack.summary.branches') + if data['behindcount'] == -1: + fm.plain(', ') + fm.plain('ambigious rebase destination', label='topic.stack.summary.behinderror') + elif data['behindcount']: + fm.plain(', ') + fm.plain('%d behind' % data['behindcount'], label='topic.stack.summary.behindcount') + fm.plain('\n') for idx, r in enumerate(getstack(repo, topic), 1): ctx = repo[r] diff -r 5c40dd2cf131 -r ce86f7bb4b7b tests/test-topic-stack-data.t --- a/tests/test-topic-stack-data.t Fri Aug 26 14:23:31 2016 +0200 +++ b/tests/test-topic-stack-data.t Fri Aug 26 14:55:58 2016 +0200 @@ -251,19 +251,19 @@ ^ add base_e $ hg stack baz ### topic: baz - ### branch: default + ### branch: default, 2 behind t2: add baz_b t1: add baz_a ^ add base_c $ hg stack foo ### topic: foo - ### branch: lake + ### branch: lake, ambigious rebase destination t2@ add foo_b (current) t1: add foo_a ^ add lake_a $ hg stack fuz ### topic: fuz - ### branch: default + ### branch: default, 1 behind t3$ add fuz_c (unstable) t2$ add fuz_b (unstable) t1: fuz1_a