hgext/obsolete.py
changeset 433 aa1255c2ac8f
parent 432 6347bc69b49a
child 434 9863e196cc65
--- a/hgext/obsolete.py	Tue Aug 07 14:19:18 2012 +0200
+++ b/hgext/obsolete.py	Tue Aug 07 14:32:54 2012 +0200
@@ -56,6 +56,13 @@
 _unpack = struct.unpack
 
 from mercurial import util
+
+try:
+    from mercurial import obsolete
+    obsolete._enabled = True
+except ImportError:
+        raise util.Abort('Obsolete extension requires Mercurial 2.3 (or later)')
+
 from mercurial import context
 from mercurial import revset
 from mercurial import scmutil
@@ -71,9 +78,7 @@
 from mercurial import localrepo
 from mercurial import cmdutil
 from mercurial import templatekw
-from mercurial import obsolete
 from mercurial.localrepo import storecache
-obsolete._enabled = True
 
 # This extension hold the following code
 #
@@ -783,8 +788,6 @@
     if not repo.local():
         return
 
-    if not util.safehasattr(repo.opener, 'tryread'):
-        raise util.Abort('Obsolete extension requires Mercurial 2.2 (or later)')
     opush = repo.push
     o_updatebranchcache = repo.updatebranchcache