compat: fix topicset for mercurial 4.1
authorBoris Feld <boris.feld@octobus.net>
Thu, 29 Jun 2017 18:22:06 +0200
changeset 2686 fc3a66ad635b
parent 2685 008f7cd1fcbe
child 2687 4a02781d90ce
compat: fix topicset for mercurial 4.1 The 'getrevset' method is not available there.
hgext3rd/topic/revset.py
--- a/hgext3rd/topic/revset.py	Mon Jun 26 17:19:03 2017 +0200
+++ b/hgext3rd/topic/revset.py	Thu Jun 29 18:22:06 2017 +0200
@@ -1,7 +1,6 @@
 from __future__ import absolute_import
 
 from mercurial import (
-    phases,
     revset,
     util,
 )
@@ -36,7 +35,17 @@
         _kind, _pattern, matcher = mkmatcher(topic)
     else:
         matcher = lambda t: bool(t)
-    mutable = repo._phasecache.getrevset(repo, (phases.draft, phases.secret))
+
+    # XXX-mercurial 4.1 compat
+    # otherwise use:
+    #
+    #   mutable = repo._phasecache.getrevset(repo, (phases.draft, phases.secret))
+    #
+    mutable = set()
+    for u in repo._phasecache._phasesets[1:]:
+        mutable.update(u)
+    mutable = revset.baseset(mutable - repo.changelog.filteredrevs)
+    mutable.sort()
 
     rawchange = repo.changelog.changelogrevision
     key = constants.extrakey