topic: work around stringmatcher moving during development of hg 3.6
authorAugie Fackler <raf@durin42.com>
Wed, 14 Oct 2015 12:09:11 -0400
changeset 1865 558dd43b599d
parent 1864 70d1191fceed
child 1866 13fc93fb7fbe
topic: work around stringmatcher moving during development of hg 3.6
src/topic/revset.py
--- a/src/topic/revset.py	Wed Sep 30 18:06:42 2015 -0400
+++ b/src/topic/revset.py	Wed Oct 14 12:09:11 2015 -0400
@@ -1,7 +1,14 @@
 from mercurial import revset
+from mercurial import util
 
 from . import constants
 
+try:
+    mkmatcher = revset._stringmatcher
+except AttributeError:
+    mkmatcher = util.stringmatcher
+
+
 def topicset(repo, subset, x):
     """`topic([topic])`
     Specified topic or all changes with any topic specified.
@@ -17,7 +24,7 @@
         topic = revset.getstring(args[0], 'topic() argument must be a string')
         if topic == '.':
             topic = repo['.'].extra().get('topic', '')
-        _kind, _pattern, matcher = revset._stringmatcher(topic)
+        _kind, _pattern, matcher = mkmatcher(topic)
     else:
         matcher = lambda t: bool(t)
     drafts = subset.filter(lambda r: repo[r].mutable())