Commits

Pierre-Yves David committed aa1255c

obsolete: move version checks at the start of the file

  • Participants
  • Parent commits 6347bc6
  • Branches default

Comments (0)

Files changed (1)

File hgext/obsolete.py

 _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
 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
 #
     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