# HG changeset patch # User Pierre-Yves David # Date 1457981003 0 # Node ID 5e9ce63107209754da23a87142ad2b9de99be9df # Parent 3b42478ef01736f0ecb79079aa505a1b0d37eade stack: show the currently active changeset and unstable ones Still super basic, but give a basic idea of the feature. We use both symbols and explicit text because symbols are cool but text is more explicit diff -r 3b42478ef017 -r 5e9ce6310720 hgext3rd/topic/stack.py --- a/hgext3rd/topic/stack.py Mon Mar 14 18:40:00 2016 +0000 +++ b/hgext3rd/topic/stack.py Mon Mar 14 18:43:23 2016 +0000 @@ -20,7 +20,21 @@ raise error.Abort(_('no active topic to list')) for idx, r in enumerate(getstack(repo, topic)): # super crude initial version - l = "t%d: %s\n" % (idx, repo[r].description().splitlines()[0]) + symbol = ':' + state = 'clean' + if repo.revs('%d and parents()', r): + symbol = '@' + state = 'current' + if repo.revs('%d and unstable()', r): + symbol = '$' + state = 'unstable' + if state == 'clean': + l = "t%d%s %s\n" % (idx, symbol, + repo[r].description().splitlines()[0]) + else: + l = "t%d%s %s (%s)\n" % (idx, symbol, + repo[r].description().splitlines()[0], + state) ui.write(l) # Copied from evolve 081605c2e9b6 diff -r 3b42478ef017 -r 5e9ce6310720 tests/test-topic-stack.t --- a/tests/test-topic-stack.t Mon Mar 14 18:40:00 2016 +0000 +++ b/tests/test-topic-stack.t Mon Mar 14 18:43:23 2016 +0000 @@ -60,7 +60,7 @@ t0: c_c t1: c_d t2: c_e - t3: c_f + t3@ c_f (current) error case, nothing to list @@ -105,6 +105,6 @@ $ hg topic --list t0: c_c - t1: c_d - t2: c_e - t3: c_f + t1@ c_d (current) + t2$ c_e (unstable) + t3$ c_f (unstable)