changeset 5431:b34af5087714 stable

compat: compatibility for mergestate being a separate module in 5.5
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 29 May 2020 14:29:03 +0800
parents e320a84b65c1
children 58b0dfc6dd52
files hgext3rd/evolve/compat.py hgext3rd/evolve/evolvecmd.py
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/compat.py	Tue Jul 21 12:52:52 2020 +0800
+++ b/hgext3rd/evolve/compat.py	Fri May 29 14:29:03 2020 +0800
@@ -12,6 +12,7 @@
 from mercurial import (
     context,
     copies,
+    merge as mergemod,
     obsolete,
     pycompat,
     registrar,
@@ -35,6 +36,13 @@
 except (AttributeError, ImportError):
     dirs = util.dirs  # pytype: disable=module-attr
 
+# hg <= 5.4 (b7808443ed6a)
+try:
+    from mercurial import mergestate as mergestatemod
+    mergestate = mergestatemod.mergestate
+except (AttributeError, ImportError):
+    mergestate = mergemod.mergestate  # pytype: disable=module-attr
+
 from . import (
     exthelper,
 )
--- a/hgext3rd/evolve/evolvecmd.py	Tue Jul 21 12:52:52 2020 +0800
+++ b/hgext3rd/evolve/evolvecmd.py	Fri May 29 14:29:03 2020 +0800
@@ -1981,7 +1981,7 @@
 def continueevolve(ui, repo, evolvestate):
     """logic for handling of `hg evolve --continue`"""
 
-    ms = merge.mergestate.read(repo)
+    ms = compat.mergestate.read(repo)
     mergeutil.checkunresolved(ms)
     if (evolvestate[b'command'] == b'next'
         or evolvestate[b'category'] == b'orphan'):