# HG changeset patch # User Anton Shestakov # Date 1535623361 -28800 # Node ID 90783c9c86097cabd1b3bb949ecdb8978b618264 # Parent 054d288680b4efb3b0888c3216ab6ca6776b4a65 topic: prepare to handle non-string arguments to topic() revset diff -r 054d288680b4 -r 90783c9c8609 hgext3rd/topic/revset.py --- a/hgext3rd/topic/revset.py Thu Aug 30 17:42:11 2018 +0800 +++ b/hgext3rd/topic/revset.py Thu Aug 30 18:02:41 2018 +0800 @@ -1,6 +1,7 @@ from __future__ import absolute_import from mercurial import ( + error, registrar, revset, util, @@ -38,9 +39,13 @@ if not args: return (subset & mutable).filter(lambda r: bool(repo[r].topic())) + + try: + topic = revset.getstring(args[0], 'topic() argument must be a string') + except error.ParseError: + # not a string, but another revset + raise 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)