Mercurial > evolve
comparison hgext3rd/topic/revset.py @ 4058:90783c9c8609
topic: prepare to handle non-string arguments to topic() revset
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Thu, 30 Aug 2018 18:02:41 +0800 |
parents | 054d288680b4 |
children | 1914a53fe792 |
comparison
equal
deleted
inserted
replaced
4057:054d288680b4 | 4058:90783c9c8609 |
---|---|
1 from __future__ import absolute_import | 1 from __future__ import absolute_import |
2 | 2 |
3 from mercurial import ( | 3 from mercurial import ( |
4 error, | |
4 registrar, | 5 registrar, |
5 revset, | 6 revset, |
6 util, | 7 util, |
7 ) | 8 ) |
8 | 9 |
36 | 37 |
37 mutable = revset._notpublic(repo, revset.fullreposet(repo), ()) | 38 mutable = revset._notpublic(repo, revset.fullreposet(repo), ()) |
38 | 39 |
39 if not args: | 40 if not args: |
40 return (subset & mutable).filter(lambda r: bool(repo[r].topic())) | 41 return (subset & mutable).filter(lambda r: bool(repo[r].topic())) |
42 | |
43 try: | |
44 topic = revset.getstring(args[0], 'topic() argument must be a string') | |
45 except error.ParseError: | |
46 # not a string, but another revset | |
47 raise | |
41 else: | 48 else: |
42 # match a specific topic | |
43 topic = revset.getstring(args[0], 'topic() argument must be a string') | |
44 if topic == '.': | 49 if topic == '.': |
45 topic = repo['.'].extra().get('topic', '') | 50 topic = repo['.'].extra().get('topic', '') |
46 _kind, _pattern, matcher = mkmatcher(topic) | 51 _kind, _pattern, matcher = mkmatcher(topic) |
47 | 52 |
48 rawchange = repo.changelog.changelogrevision | 53 rawchange = repo.changelog.changelogrevision |