mercurial/cmdutil.py
changeset 22248 75618a223e18
parent 22237 808926c76cac
child 22249 f5ff18f65b73
equal deleted inserted replaced
22247:8341c677c204 22248:75618a223e18
   106                 message = '\n'.join(util.readfile(logfile).splitlines())
   106                 message = '\n'.join(util.readfile(logfile).splitlines())
   107         except IOError, inst:
   107         except IOError, inst:
   108             raise util.Abort(_("can't read commit message '%s': %s") %
   108             raise util.Abort(_("can't read commit message '%s': %s") %
   109                              (logfile, inst.strerror))
   109                              (logfile, inst.strerror))
   110     return message
   110     return message
       
   111 
       
   112 def mergeeditform(ctxorbool, baseform):
       
   113     """build appropriate editform from ctxorbool and baseform
       
   114 
       
   115     'cxtorbool' is one of a ctx to be committed, or a bool whether
       
   116     merging is committed.
       
   117 
       
   118     This returns editform 'baseform' with '.merge' if merging is
       
   119     committed, or one with '.normal' suffix otherwise.
       
   120     """
       
   121     if isinstance(ctxorbool, bool):
       
   122         if ctxorbool:
       
   123             return baseform + ".merge"
       
   124     elif 1 < len(ctxorbool.parents()):
       
   125         return baseform + ".merge"
       
   126 
       
   127     return baseform + ".normal"
   111 
   128 
   112 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
   129 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
   113                     editform='', **opts):
   130                     editform='', **opts):
   114     """get appropriate commit message editor according to '--edit' option
   131     """get appropriate commit message editor according to '--edit' option
   115 
   132