changeset 2315:e16f6bef5848 stable

compat: make obscache code compatible with Mercurial version prior to 4.2 the phasecache.getrevset method is new in 4.2.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 03 May 2017 12:54:11 +0200
parents 2e0a15985657
children 35a548465647
files hgext3rd/evolve/obscache.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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