Mercurial > hg > evolve
changeset 3082:4746b92cc1f8
topics/ui: signal when an operation entails voiding a topic
Typical situations may include:
* publish
* push (to publishing server)
* pull
* fold
author | Aurélien Campéas |
---|---|
date | Fri, 22 Sep 2017 16:41:37 +0200 |
parents | f63c97c01f92 |
children | d59d6413bb68 53246d237373 |
files | hgext3rd/topic/__init__.py tests/test-topic-fold.t tests/test-topic-stack.t tests/test-topic-tutorial.t tests/test-topic.t |
diffstat | 5 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py +++ b/hgext3rd/topic/__init__.py @@ -54,6 +54,7 @@ import re import time +import weakref from mercurial.i18n import _ from mercurial import ( @@ -311,6 +312,24 @@ peer.__class__ = topicpeer return peer + def transaction(self, *a, **k): + tr = super(topicrepo, self).transaction(*a, **k) + + reporef = weakref.ref(self) + + def currenttopicempty(tr): + # check active topic emptyness + ct = self.currenttopic + if not ct: + return + repo = reporef() + empty = stack.stackdata(repo, topic=ct)['changesetcount'] == 0 + if empty: + ui.status('active topic %r is now empty\n' % ct) + + tr.addpostclose('signalcurrenttopicempty', currenttopicempty) + return tr + repo.__class__ = topicrepo repo._topics = None if util.safehasattr(repo, 'names'):
--- a/tests/test-topic-fold.t +++ b/tests/test-topic-fold.t @@ -90,6 +90,7 @@ o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7 topics: $ hg fold --exact -r "(tip~1)::" -m "folded 2" + active topic 'myotherfeature' is now empty 2 changesets folded clearing empty topic "myotherfeature" 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-topic-stack.t +++ b/tests/test-topic-stack.t @@ -59,6 +59,7 @@ t2@ c_b (current) t1: c_a $ hg phase --public 'topic("other")' + active topic 'other' is now empty 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.
--- a/tests/test-topic-tutorial.t +++ b/tests/test-topic-tutorial.t @@ -584,6 +584,7 @@ adding file changes added 2 changesets with 2 changes to 1 files 2 new obsolescence markers + active topic 'food' is now empty $ hg topics * food
--- a/tests/test-topic.t +++ b/tests/test-topic.t @@ -401,6 +401,7 @@ query tip $ hg phase --public narf + active topic 'narf' is now empty POSSIBLE BUG: narf topic stays alive even though we just made all narf commits public: @@ -461,6 +462,7 @@ adding manifests adding file changes added 3 changesets with 3 changes to 1 files + active topic 'query' is now empty (run 'hg update' to get a working copy) $ hg topics * query @@ -474,6 +476,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) + active topic 'query' is now empty (run 'hg heads' to see heads) $ hg topics fran