Mercurial > public > mercurial-scm > evolve
diff hgext3rd/topic/__init__.py @ 2988:62201935e1a7
topics/ui: detect and signal when an empty changeset becomes non-empty
author | Aur?lien Camp?as |
---|---|
date | Tue, 26 Sep 2017 12:39:11 +0200 |
parents | d59d6413bb68 |
children | c2102598adf5 |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Fri Sep 22 18:01:29 2017 +0200 +++ b/hgext3rd/topic/__init__.py Tue Sep 26 12:39:11 2017 +0200 @@ -318,17 +318,28 @@ if ctr is not None: return tr + # real transaction start + ct = self.currenttopic + if not ct: + return tr + ctwasempty = stack.stackdata(self, topic=ct)['changesetcount'] == 0 + 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: + csetcount = stack.stackdata(repo, topic=ct)['changesetcount'] + empty = csetcount == 0 + if empty and not ctwasempty: ui.status('active topic %r is now empty\n' % ct) + if ctwasempty and not empty: + if csetcount == 1: + msg = _('active topic %r grew its first changeset\n') + ui.status(msg % ct) + else: + msg = _('active topic %r grew its %s first changesets\n') + ui.status(msg % (ct, csetcount)) tr.addpostclose('signalcurrenttopicempty', currenttopicempty) return tr