# HG changeset patch
# User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
# Date 1398174791 -7200
# Node ID a22d4972e01fd3478ac5b4f4fae810591ff0049d
# Parent  b04758acf410e18ea9cd44cc3f1b31d7ebc4a2db
push: fix obsolete feature detection

The obsolete feature detection didn't work with demandimport, breaking
hgsubversion when running against 2.0-2.3.

diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -192,7 +192,10 @@ def push(repo, dest, force, revs):
     ui = repo.ui
     old_encoding = util.swap_out_encoding()
 
-    hasobsolete = obsolete and obsolete._enabled
+    try:
+        hasobsolete = obsolete._enabled
+    except:
+        hasobsolete = False
 
     temporary_commits = []
     try:
diff --git a/tests/test_util.py b/tests/test_util.py
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -29,6 +29,7 @@ from mercurial import extensions
 
 try:
     from mercurial import obsolete
+    obsolete._enabled
 except ImportError:
     obsolete = None