# HG changeset patch # User Anton Shestakov # Date 1558169807 -28800 # Node ID c24dabf8e848ec19a665460a9cc9e060330d2818 # Parent dbf676c8624437d2b6f101d0c5dd4e5868881a7f stack: handle hash sizes when --debug flag is provided Since showstack() now uses fm.hexfunc() for node hashes, which depends on ui.debugflag, we should handle situations when hashes are full-sized as well. diff -r dbf676c86244 -r c24dabf8e848 hgext3rd/topic/stack.py --- a/hgext3rd/topic/stack.py Fri May 17 17:50:25 2019 +0800 +++ b/hgext3rd/topic/stack.py Sat May 18 16:56:47 2019 +0800 @@ -358,9 +358,16 @@ fm.data(isentry=isentry) if idx is None: - fm.plain(' ') + spacewidth = 0 if ui.verbose: - fm.plain(' ') + # parentheses plus short node hash + spacewidth = 2 + 12 + if ui.debugflag: + # parentheses plus full node hash + spacewidth = 2 + 40 + # s# alias width + spacewidth += 2 + fm.plain(' ' * spacewidth) else: fm.write('stack_index', '%s%%d' % prefix, idx, label=labelsgen('topic.stack.index', states)) diff -r dbf676c86244 -r c24dabf8e848 tests/test-topic-stack.t --- a/tests/test-topic-stack.t Fri May 17 17:50:25 2019 +0800 +++ b/tests/test-topic-stack.t Sat May 18 16:56:47 2019 +0800 @@ -628,6 +628,22 @@ s1: c_D s0^ c_c (base) + $ hg stack -v + ### topic: foobar + ### target: default (branch), 3 behind + s2(ea0f882ce093)@ c_e (current) + ^ c_h + s1(d2f548af67ab): c_D + s0(8522f9e3fee9)^ c_c (base) + + $ hg stack --debug + ### topic: foobar + ### target: default (branch), 3 behind + s2(ea0f882ce093a2ad63db49083c5cb98a24a9470e)@ c_e (current) + ^ c_h + s1(d2f548af67ab55b08452a3e00a539319490fcd5b): c_D + s0(8522f9e3fee92d4ec4e688ac3fbd2ee0f8fd5036)^ c_c (base) + $ hg stack foo ### topic: foo ### target: default (branch), ambiguous rebase destination - topic 'foo' has 3 heads