compat: make obscache code compatible with Mercurial version prior to 4.2
the phasecache.getrevset method is new in 4.2.
--- a/hgext3rd/evolve/obscache.py Wed May 03 12:41:54 2017 +0200
+++ b/hgext3rd/evolve/obscache.py Wed May 03 12:54:11 2017 +0200
@@ -17,6 +17,7 @@
obsolete,
phases,
node,
+ util,
)
from . import (
@@ -329,7 +330,11 @@
"""the set of obsolete revisions"""
obs = set()
repo = repo.unfiltered()
- notpublic = repo._phasecache.getrevset(repo, (phases.draft, phases.secret))
+ if util.safehasattr(repo._phasecache, 'getrevset'):
+ notpublic = repo._phasecache.getrevset(repo, (phases.draft, phases.secret))
+ else:
+ # < hg-4.2 compat
+ notpublic = repo.revs("not public()")
if notpublic:
obscache = repo.obsstore.obscache
# Since we warm the cache at the end of every transaction, the cache