Commits

Alain Leufroy committed 470232c

[obsolete] fix new api: use the new phase cache api

Introduced by `b6081c2c4647@mercurial <http://selenic.com/repo/hg/rev/b6081c2c4647>`_

  • Participants
  • Parent commits a60d119
  • Branches default

Comments (0)

Files changed (1)

File hgext/obsolete.py

 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
 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"""