compat: work around the lack of configoverride in mercurial 4.0 stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 20 Oct 2017 20:58:35 +0200
branchstable
changeset 3095 7a5941d91fc0
parent 3094 e11e018e8338
child 3096 c458c0856ee5
compat: work around the lack of configoverride in mercurial 4.0 The phase preservation will stay broken on 4.0 and below
hgext3rd/topic/__init__.py
--- a/hgext3rd/topic/__init__.py	Fri Oct 20 19:29:56 2017 +0200
+++ b/hgext3rd/topic/__init__.py	Fri Oct 20 20:58:35 2017 +0200
@@ -769,8 +769,11 @@
 
         # phase handling
         commitphase = c.phase()
-        overrides = {('phases', 'new-commit'): commitphase}
-        with repo.ui.configoverride(overrides, 'changetopic'):
+        if util.safehasattr(repo.ui, 'configoverride'):
+            overrides = {('phases', 'new-commit'): commitphase}
+            with repo.ui.configoverride(overrides, 'changetopic'):
+                newnode = repo.commitctx(mc)
+        else: # do not attempt to preserver phase (hg <= 4.0)
             newnode = repo.commitctx(mc)
 
         successors[c.node()] = (newnode,)