# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1507870132 -19800 # Node ID f43a310c43389a05de08586a4f979d78b7adcad5 # Parent 02b220984b012cea253e316660c5c8cc82e651b3 topics: show changesetcount, troubledcount and headscount by default diff -r 02b220984b01 -r f43a310c4338 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Fri Oct 13 10:01:38 2017 +0530 +++ b/hgext3rd/topic/__init__.py Fri Oct 13 10:18:52 2017 +0530 @@ -762,7 +762,7 @@ return _showlasttouched(repo, fm, opts) activetopic = repo.currenttopic namemask = '%s' - if repo.topics and ui.verbose: + if repo.topics: maxwidth = max(len(t) for t in repo.topics) namemask = '%%-%is' % maxwidth for topic in sorted(repo.topics): @@ -778,31 +778,33 @@ fm.plain(' %s ' % marker, label=label) fm.write('topic', namemask, topic, label=label) fm.data(active=active) + + data = stack.stack(repo, topic=topic) + fm.plain(' (') if ui.verbose: - # XXX we should include the data even when not verbose - data = stack.stack(repo, topic=topic) - - fm.plain(' (') fm.write('branches+', 'on branch: %s', '+'.join(data.branches), # XXX use list directly after 4.0 is released label='topic.list.branches') fm.plain(', ') - fm.write('changesetcount', '%d changesets', data.changesetcount, - label='topic.list.changesetcount') + fm.write('changesetcount', '%d changesets', data.changesetcount, + label='topic.list.changesetcount') + + if data.troubledcount: + fm.plain(', ') + fm.write('troubledcount', '%d troubled', + data.troubledcount, + label='topic.list.troubledcount') - if data.troubledcount: - fm.plain(', ') - fm.write('troubledcount', '%d troubled', - data.troubledcount, - label='topic.list.troubledcount') + headcount = len(data.heads) + if 1 < headcount: + fm.plain(', ') + fm.write('headcount', '%d heads', + headcount, + label='topic.list.headcount.multiple') - headcount = len(data.heads) - if 1 < headcount: - fm.plain(', ') - fm.write('headcount', '%d heads', - headcount, - label='topic.list.headcount.multiple') + if ui.verbose: + # XXX we should include the data even when not verbose behindcount = data.behindcount if 0 < behindcount: @@ -815,8 +817,7 @@ fm.write('behinderror', '%s', _('ambiguous destination: %s') % data.behinderror, label='topic.list.behinderror') - fm.plain(')') - fm.plain('\n') + fm.plain(')\n') fm.end() def _showlasttouched(repo, fm, opts): diff -r 02b220984b01 -r f43a310c4338 tests/test-split.t --- a/tests/test-split.t Fri Oct 13 10:01:38 2017 +0530 +++ b/tests/test-split.t Fri Oct 13 10:18:52 2017 +0530 @@ -485,4 +485,4 @@ summary: split8 $ hg topic - * mytopic + * mytopic (2 changesets) diff -r 02b220984b01 -r f43a310c4338 tests/test-topic-change.t --- a/tests/test-topic-change.t Fri Oct 13 10:01:38 2017 +0530 +++ b/tests/test-topic-change.t Fri Oct 13 10:18:52 2017 +0530 @@ -92,10 +92,10 @@ Clearing the active topic using --clear $ hg topic - * foo + * foo (8 changesets) $ hg topic --clear $ hg topic - foo + foo (8 changesets) Changing topics on some revisions (also testing issue 5441) $ hg topic -r 12:: bar diff -r 02b220984b01 -r f43a310c4338 tests/test-topic-dest.t --- a/tests/test-topic-dest.t Fri Oct 13 10:01:38 2017 +0530 +++ b/tests/test-topic-dest.t Fri Oct 13 10:18:52 2017 +0530 @@ -234,12 +234,12 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg topic - elephant - * monkey + elephant (1 changesets) + * monkey (2 changesets) $ hg ci -m 'merge with default' $ hg topic - elephant - * monkey + elephant (1 changesets) + * monkey (3 changesets) $ hg log -G @ 13 (monkey) merge with default |\ diff -r 02b220984b01 -r f43a310c4338 tests/test-topic-shelve.t --- a/tests/test-topic-shelve.t Fri Oct 13 10:01:38 2017 +0530 +++ b/tests/test-topic-shelve.t Fri Oct 13 10:18:52 2017 +0530 @@ -15,12 +15,12 @@ $ hg topic "testing-shelve" marked working directory as topic: testing-shelve $ hg topic - * testing-shelve + * testing-shelve (0 changesets) $ hg ci -m "First commit" -A adding a active topic 'testing-shelve' grew its first changeset $ hg topic - * testing-shelve + * testing-shelve (1 changesets) $ echo " World" >> a $ hg stack ### topic: testing-shelve @@ -34,7 +34,7 @@ shelved as default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg topic - * testing-shelve + * testing-shelve (1 changesets) $ hg stack ### topic: testing-shelve ### target: default (branch) @@ -45,7 +45,7 @@ $ hg unshelve unshelving change 'default' $ hg topic - * testing-shelve + * testing-shelve (1 changesets) $ hg stack ### topic: testing-shelve ### target: default (branch) diff -r 02b220984b01 -r f43a310c4338 tests/test-topic-stack-data.t --- a/tests/test-topic-stack-data.t Fri Oct 13 10:01:38 2017 +0530 +++ b/tests/test-topic-stack-data.t Fri Oct 13 10:18:52 2017 +0530 @@ -165,18 +165,18 @@ basic output $ hg topic - bar - baz - * foo - fuz + bar (5 changesets, 1 troubled, 2 heads) + baz (2 changesets) + * foo (2 changesets) + fuz (3 changesets, 2 troubled) quiet version $ hg topic --quiet - bar - baz - foo - fuz + bar (5 changesets, 1 troubled, 2 heads) + baz (2 changesets) + foo (2 changesets) + fuz (3 changesets, 2 troubled) verbose @@ -192,19 +192,26 @@ [ { "active": false, - "topic": "bar" + "changesetcount": 5, + "headcount": 2, + "topic": "bar", + "troubledcount": 1 }, { "active": false, + "changesetcount": 2, "topic": "baz" }, { "active": true, + "changesetcount": 2, "topic": "foo" }, { "active": false, - "topic": "fuz" + "changesetcount": 3, + "topic": "fuz", + "troubledcount": 2 } ] diff -r 02b220984b01 -r f43a310c4338 tests/test-topic-stack.t --- a/tests/test-topic-stack.t Fri Oct 13 10:01:38 2017 +0530 +++ b/tests/test-topic-stack.t Fri Oct 13 10:18:52 2017 +0530 @@ -66,8 +66,8 @@ After changing the phase of all the changesets in "other" to public, the topic should still be active, but is empty. We should be better at informating the user about it and displaying good data in this case. $ hg topic - foo - * other + foo (4 changesets) + * other (0 changesets) $ hg stack ### topic: other ### target: default (branch) @@ -84,7 +84,7 @@ 'hg stack' list all changeset in the topic $ hg topic - * foo + * foo (4 changesets) $ hg stack ### topic: foo ### target: default (branch) @@ -206,7 +206,7 @@ check that topics and stack are available even if ui.strict=true $ hg topics - * foo + * foo (4 changesets) $ hg stack ### topic: foo ### target: default (branch) @@ -216,7 +216,7 @@ t1: c_c t0^ c_b (base) $ hg topics --config ui.strict=true - * foo + * foo (4 changesets) $ hg stack --config ui.strict=true ### topic: foo ### target: default (branch) diff -r 02b220984b01 -r f43a310c4338 tests/test-topic-tutorial.t --- a/tests/test-topic-tutorial.t Fri Oct 13 10:01:38 2017 +0530 +++ b/tests/test-topic-tutorial.t Fri Oct 13 10:18:52 2017 +0530 @@ -101,7 +101,7 @@ changeset yet: $ hg topics - * food + * food (0 changesets) $ hg summary parent: 0:38da43f0a2ea tip @@ -259,7 +259,7 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg topics - food + food (2 changesets) Note that ``default`` (name of the branch) now refers to the tipmost changeset of default without a topic: @@ -336,7 +336,7 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg topics - * food + * food (2 changesets) Updating to any changeset that is part of a topic activates the topic regardless of how the revision was specified: @@ -349,7 +349,7 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg topics - * food + * food (2 changesets) .. Server side activity: @@ -575,7 +575,7 @@ The topic information will disappear when we publish the changesets: $ hg topics - * food + * food (2 changesets) $ hg push pushing to $TESTTMP/server (glob) @@ -588,7 +588,7 @@ active topic 'food' is now empty $ hg topics - * food + * food (0 changesets) The topic still exists, and any new commit will be in the topic. But note that it is now devoid of any commit. @@ -764,8 +764,8 @@ We now have two topics: $ hg topics - * drinks - tools + * drinks (2 changesets) + tools (3 changesets) The information displayed by ``hg stack`` adapts to the active topic: diff -r 02b220984b01 -r f43a310c4338 tests/test-topic.t --- a/tests/test-topic.t Fri Oct 13 10:01:38 2017 +0530 +++ b/tests/test-topic.t Fri Oct 13 10:18:52 2017 +0530 @@ -132,13 +132,13 @@ [255] $ hg revert alpha $ hg topic - * topicflag + * topicflag (0 changesets) Make a topic $ hg topic narf $ hg topics - * narf + * narf (0 changesets) $ hg topics -v * narf (on branch: default, 0 changesets) $ hg stack @@ -157,8 +157,8 @@ $ hg topic fran marked working directory as topic: fran $ hg topics - * fran - narf + * fran (0 changesets) + narf (1 changesets) $ hg topics --current fran $ echo >> fran work >> beta @@ -168,8 +168,8 @@ switching to topic narf 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg topic - fran - * narf + fran (1 changesets) + * narf (1 changesets) $ hg log -r . -T '{topics}\n' narf $ echo 'narf!!!' >> alpha @@ -373,7 +373,7 @@ | $ hg topics - * query + * query (1 changesets) $ cd ../pinky $ hg co query switching to topic query @@ -392,9 +392,9 @@ $ hg topic narf $ hg ci -m 'Finish narf' $ hg topics - fran - * narf - query + fran (1 changesets) + * narf (2 changesets) + query (2 changesets) $ hg debugnamecomplete # branch:topic here is a buggy side effect default default:fran @@ -411,8 +411,8 @@ narf commits public: $ hg topics - fran - * narf + fran (1 changesets) + * narf (0 changesets) $ hg log -Gl 6 @ changeset: 9:ae074045b7a7 |\ tag: tip @@ -454,7 +454,7 @@ $ cd ../brain $ hg topics - * query + * query (1 changesets) $ hg pull ../pinky -r narf pulling from ../pinky abort: unknown revision 'narf'! @@ -469,7 +469,7 @@ active topic 'query' is now empty (run 'hg update' to get a working copy) $ hg topics - * query + * query (0 changesets) We can pull in the draft-phase change and we get the new topic @@ -482,8 +482,8 @@ added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads' to see heads) $ hg topics - fran - * query + fran (1 changesets) + * query (0 changesets) $ hg log -Gr 'draft()' o changeset: 9:0469d521db49 | tag: tip @@ -500,7 +500,7 @@ $ hg topics --clear clearing empty topic "query" $ hg topics - fran + fran (1 changesets) Topic revset $ hg log -r 'topic()' -G @@ -587,7 +587,7 @@ Match current topic: $ hg topic - fran + fran (1 changesets) $ hg log -r 'topic(.)' (no output is expected) $ hg co fran @@ -605,7 +605,7 @@ Deactivate the topic. $ hg topics - * fran + * fran (1 changesets) $ hg topics --clear $ echo fran? >> beta $ hg ci -m 'fran?' @@ -626,7 +626,7 @@ | $ hg topics - fran + fran (1 changesets) Testing for updating to t0 ========================== @@ -645,7 +645,7 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg topic - * fran + * fran (1 changesets) $ hg stack ### topic: fran ### target: default (branch), ambigious rebase destination - branch 'default' has 2 heads @@ -730,9 +730,9 @@ summary: added a $ hg topics - topic1970 - topic1990 - * topic2010 + topic1970 (1 changesets) + topic1990 (1 changesets) + * topic2010 (1 changesets) $ hg topics --age * topic2010 (2010-01-01 by bar)