diff -r 8341c677c204 -r 75618a223e18 mercurial/cmdutil.py --- 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