changeset 3095:7a5941d91fc0 stable

compat: work around the lack of configoverride in mercurial 4.0 The phase preservation will stay broken on 4.0 and below
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 20 Oct 2017 20:58:35 +0200
parents e11e018e8338
children c458c0856ee5
files hgext3rd/topic/__init__.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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,)