changeset 5819:82040a455e71

evolve: check if in-memory is supported on a good enough level for evolve
author Anton Shestakov <av6@dwimlabs.net>
date Tue, 09 Mar 2021 18:50:10 +0800
parents 524eb673ac52
children 5341d7c30e68 7dfb3b267070 ce765eb3cfd2
files CHANGELOG hgext3rd/evolve/evolvecmd.py
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Tue Feb 02 00:05:19 2021 +0530
+++ b/CHANGELOG	Tue Mar 09 18:50:10 2021 +0800
@@ -5,7 +5,7 @@
 --------------------
 
   * evolve: add a experimental.evolution.in-memory config for running evolve
-    in memory
+    in memory (hg >= 5.6)
   * evolve: improve content-divergence resolution that involves parent changes
   * evolve: preserve wdir parent when using `hg evolve --stop`
   * obslog: clarify the command name in the help,
--- a/hgext3rd/evolve/evolvecmd.py	Tue Feb 02 00:05:19 2021 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Mar 09 18:50:10 2021 +0800
@@ -918,6 +918,13 @@
     return commitmsg
 
 def use_in_memory_merge(repo):
+    try:
+        from mercurial import mergestate as mergestatemod
+        mergestatemod.memmergestate
+    except (AttributeError, ImportError):
+        # no in-memory evolve if Mercurial lacks the required code
+        # hg <= 5.5 (19590b126764)
+        return False
     config_value = repo.ui.config(b'experimental', b'evolution.in-memory')
     if config_value == b'force':
         return True