mercurial/cmdutil.py
changeset 22248 75618a223e18
parent 22237 808926c76cac
child 22249 f5ff18f65b73
--- a/mercurial/cmdutil.py	Sat Aug 16 10:19:26 2014 -0700
+++ b/mercurial/cmdutil.py	Sat Aug 16 10:43:59 2014 +0900
@@ -109,6 +109,23 @@
                              (logfile, inst.strerror))
     return message
 
+def mergeeditform(ctxorbool, baseform):
+    """build appropriate editform from ctxorbool and baseform
+
+    'cxtorbool' is one of a ctx to be committed, or a bool whether
+    merging is committed.
+
+    This returns editform 'baseform' with '.merge' if merging is
+    committed, or one with '.normal' suffix otherwise.
+    """
+    if isinstance(ctxorbool, bool):
+        if ctxorbool:
+            return baseform + ".merge"
+    elif 1 < len(ctxorbool.parents()):
+        return baseform + ".merge"
+
+    return baseform + ".normal"
+
 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
                     editform='', **opts):
     """get appropriate commit message editor according to '--edit' option