Mercurial > evolve
changeset 4057:054d288680b4
topic: return result early if there are no arguments to topic() revset
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Thu, 30 Aug 2018 17:42:11 +0800 |
parents | 235f15c40556 |
children | 90783c9c8609 |
files | hgext3rd/topic/revset.py |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/revset.py Fri Aug 31 00:31:01 2018 +0200 +++ b/hgext3rd/topic/revset.py Thu Aug 30 17:42:11 2018 +0800 @@ -33,16 +33,17 @@ TODO: make `topic(revset)` work the same as `branch(revset)`. """ args = revset.getargs(x, 0, 1, 'topic takes one or no arguments') - if args: + + mutable = revset._notpublic(repo, revset.fullreposet(repo), ()) + + if not args: + return (subset & mutable).filter(lambda r: bool(repo[r].topic())) + else: # match a specific topic topic = revset.getstring(args[0], 'topic() argument must be a string') if topic == '.': topic = repo['.'].extra().get('topic', '') _kind, _pattern, matcher = mkmatcher(topic) - else: - matcher = lambda t: bool(t) - - mutable = revset._notpublic(repo, revset.fullreposet(repo), ()) rawchange = repo.changelog.changelogrevision key = constants.extrakey