changeset 252:470232cea503

[obsolete] fix new api: use the new phase cache api Introduced by `b6081c2c4647@mercurial <http://selenic.com/repo/hg/rev/b6081c2c4647>`_
author Alain Leufroy <alain.leufroy@logilab.fr>
date Tue, 29 May 2012 10:27:33 +0200
parents a60d11973ff3
children 8ee6c5b98d73
files hgext/obsolete.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/obsolete.py	Wed May 30 14:17:33 2012 +0200
+++ b/hgext/obsolete.py	Tue May 29 10:27:33 2012 +0200
@@ -96,6 +96,7 @@
 from mercurial import phases
 from mercurial.node import hex, bin, short, nullid
 from mercurial.lock import release
+from mercurial import localrepo
 
 try:
     from mercurial.localrepo import storecache
@@ -140,7 +141,14 @@
 def revsetobsolete(repo, subset, x):
     """obsolete changesets"""
     args = revset.getargs(x, 0, 0, 'obsolete takes no argument')
-    return [r for r in subset if r in repo._obsoleteset and repo._phaserev[r] > 0]
+    return [r for r in subset if r in repo._obsoleteset and repo._phasecache.phase(repo, r) > 0]
+
+# XXX Backward compatibility, to be removed once stabilized
+if '_phasecache' not in vars(localrepo.localrepository): # new api
+    def revsetobsolete(repo, subset, x):
+        """obsolete changesets"""
+        args = revset.getargs(x, 0, 0, 'obsolete takes no argument')
+        return [r for r in subset if r in repo._obsoleteset and repo._phaserev[r] > 0]
 
 def revsetunstable(repo, subset, x):
     """non obsolete changesets descendant of obsolete one"""