changeset 5344:c5a92ab4d2de

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 f464b29898e3
children e9d187e87678
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	Sun May 24 16:44:24 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	Sun May 24 16:44:24 2020 +0800
+++ b/hgext3rd/evolve/evolvecmd.py	Fri May 29 14:29:03 2020 +0800
@@ -1977,7 +1977,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'):