comparison mercurial/cmdutil.py @ 22248:75618a223e18

commit: change "editform" to distinguish merge commits from others "editform" argument for "getcommiteditor" is decided according to the format below: COMMAND[.ROUTE] - COMMAND: name of command - ROUTE: name of route, if there are two or more routes in COMMAND This patch uses "normal.normal" and "normal.merge" as ROUTE of "editform" instead of "normal", to distinguish merge commits from others in "hg commit" without "--amend" case. This patch assumes "editform" variations for "hg commit" below: commit.normal.normal commit.normal.merge commit.amend.normal commit.amend.merge "mergeeditform" is factored out for subsequent patches. It takes "ctxorbool" argument, because context object can't be passed in some cases.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 16 Aug 2014 10:43:59 +0900
parents 808926c76cac
children f5ff18f65b73
comparison
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