compat: work around the lack of configoverride in mercurial 4.0
The phase preservation will stay broken on 4.0 and below
--- 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,)