##// END OF EJS Templates
commit: change "editform" to distinguish merge commits from others...
FUJIWARA Katsunori -
r22248:75618a22 default
parent child Browse files
Show More
@@ -109,6 +109,23 b' def logmessage(ui, opts):'
109 (logfile, inst.strerror))
109 (logfile, inst.strerror))
110 return message
110 return message
111
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"
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
@@ -1448,7 +1448,7 b' def commit(ui, repo, *pats, **opts):'
1448 # Propagate to subrepos
1448 # Propagate to subrepos
1449 baseui.setconfig('phases', 'new-commit', 'secret', 'commit')
1449 baseui.setconfig('phases', 'new-commit', 'secret', 'commit')
1450
1450
1451 editform = 'commit.normal'
1451 editform = cmdutil.mergeeditform(repo[None], 'commit.normal')
1452 editor = cmdutil.getcommiteditor(editform=editform, **opts)
1452 editor = cmdutil.getcommiteditor(editform=editform, **opts)
1453 return repo.commit(message, opts.get('user'), opts.get('date'),
1453 return repo.commit(message, opts.get('user'), opts.get('date'),
1454 match,
1454 match,
@@ -395,7 +395,8 b' messages for each actions.'
395
395
396 - ``changeset.backout`` for :hg:`backout`
396 - ``changeset.backout`` for :hg:`backout`
397 - ``changeset.commit.amend`` for :hg:`commit --amend`
397 - ``changeset.commit.amend`` for :hg:`commit --amend`
398 - ``changeset.commit.normal`` for :hg:`commit` without ``--amend``
398 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
399 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
399 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
400 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
400 - ``changeset.gpg.sign`` for :hg:`sign`
401 - ``changeset.gpg.sign`` for :hg:`sign`
401 - ``changeset.graft`` for :hg:`graft`
402 - ``changeset.graft`` for :hg:`graft`
@@ -422,7 +423,7 b' commit message for :hg:`tag` regardless '
422
423
423 At the external editor invocation for committing, corresponding
424 At the external editor invocation for committing, corresponding
424 dot-separated list of names without ``changeset.`` prefix
425 dot-separated list of names without ``changeset.`` prefix
425 (e.g. ``commit.normal``) is in ``HGEDITFORM`` environment variable.
426 (e.g. ``commit.normal.normal``) is in ``HGEDITFORM`` environment variable.
426
427
427 In this section, items other than ``changeset`` can be referred from
428 In this section, items other than ``changeset`` can be referred from
428 others. For example, the configuration to list committed files up
429 others. For example, the configuration to list committed files up
@@ -9,7 +9,7 b' commit date test'
9 > true
9 > true
10 > EOF
10 > EOF
11 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg commit -m ""
11 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg commit -m ""
12 HGEDITFORM=commit.normal
12 HGEDITFORM=commit.normal.normal
13 abort: empty commit message
13 abort: empty commit message
14 [255]
14 [255]
15 $ hg commit -d '0 0' -m commit-1
15 $ hg commit -d '0 0' -m commit-1
@@ -282,7 +282,8 b' should fail because we are specifying a '
282
282
283 should succeed
283 should succeed
284
284
285 $ hg ci -mmerge
285 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg ci -mmerge --edit
286 HGEDITFORM=commit.normal.merge
286 $ cd ..
287 $ cd ..
287
288
288
289
General Comments 0
You need to be logged in to leave comments. Login now