# HG changeset patch # User Pierre-Yves David # Date 1344342774 -7200 # Node ID aa1255c2ac8f3e49caf15e1e1d18d34269cd1c42 # Parent 6347bc69b49a16c414b54a8f229f8eb20c933da4 obsolete: move version checks at the start of the file diff --git a/hgext/obsolete.py b/hgext/obsolete.py --- a/hgext/obsolete.py +++ b/hgext/obsolete.py @@ -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