changeset 6120:2662c6704ebd

evolve: compatibility for simplemerge.render_merge3()
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 19 Jan 2022 09:17:22 +0300
parents ba316ce15040
children 0804f51208d6
files hgext3rd/evolve/evolvecmd.py
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Fri Jan 07 15:20:17 2022 +0100
+++ b/hgext3rd/evolve/evolvecmd.py	Wed Jan 19 09:17:22 2022 +0300
@@ -816,16 +816,18 @@
     there were conflicts or not while merging the messages"""
 
     merger = simplemerge.Merge3Text(basedesc, divdesc, othdesc)
-    mdesc = []
-    kwargs = {}
-    kwargs['name_base'] = b'base'
-    kwargs['base_marker'] = b'|||||||'
-    for line in merger.merge_lines(name_a=b'divergent', name_b=b'other',
-                                   **kwargs):
-        mdesc.append(line)
+    kwargs = {'name_a': b'divergent', 'name_b': b'other', 'name_base': b'base'}
 
-    desc = b''.join(mdesc)
-    if merger.conflicts:
+    if util.safehasattr(simplemerge, 'render_merge3'):
+        lines, conflicts = simplemerge.render_merge3(merger, **kwargs)
+        desc = b''.join(lines)
+    else:
+        # hg <= 6.0 (12ac4401ff7d)
+        kwargs['base_marker'] = b'|||||||'
+        desc = b''.join(merger.merge_lines(**kwargs))
+        conflicts = merger.conflicts
+
+    if conflicts:
 
         prefixes = (b"HG: Conflicts while merging changeset description of"
                     b" content-divergent changesets.\nHG: Resolve conflicts"