##// END OF EJS Templates
ui: invoke editor for committing with HGEDITFORM environment variable...
FUJIWARA Katsunori -
r22205:9fa42972 default
parent child Browse files
Show More
@@ -2215,7 +2215,7 b' def commitforceeditor(repo, ctx, subs, f'
2215 # run editor in the repository root
2215 # run editor in the repository root
2216 olddir = os.getcwd()
2216 olddir = os.getcwd()
2217 os.chdir(repo.root)
2217 os.chdir(repo.root)
2218 text = repo.ui.edit(committext, ctx.user(), ctx.extra())
2218 text = repo.ui.edit(committext, ctx.user(), ctx.extra(), editform=editform)
2219 text = re.sub("(?m)^HG:.*(\n|$)", "", text)
2219 text = re.sub("(?m)^HG:.*(\n|$)", "", text)
2220 os.chdir(olddir)
2220 os.chdir(olddir)
2221
2221
@@ -420,6 +420,10 b' For example, ``changeset.tag.remove`` cu'
420 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
420 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
421 commit message for :hg:`tag` regardless of ``--remove`` option.
421 commit message for :hg:`tag` regardless of ``--remove`` option.
422
422
423 At the external editor invocation for committing, corresponding
424 dot-separated list of names without ``changeset.`` prefix
425 (e.g. ``commit.normal``) is in ``HGEDITFORM`` environment variable.
426
423 In this section, items other than ``changeset`` can be referred from
427 In this section, items other than ``changeset`` can be referred from
424 others. For example, the configuration to list committed files up
428 others. For example, the configuration to list committed files up
425 below can be referred as ``{listupfiles}``::
429 below can be referred as ``{listupfiles}``::
@@ -728,7 +728,7 b' class ui(object):'
728 if self.debugflag:
728 if self.debugflag:
729 opts['label'] = opts.get('label', '') + ' ui.debug'
729 opts['label'] = opts.get('label', '') + ' ui.debug'
730 self.write(*msg, **opts)
730 self.write(*msg, **opts)
731 def edit(self, text, user, extra={}):
731 def edit(self, text, user, extra={}, editform=None):
732 (fd, name) = tempfile.mkstemp(prefix="hg-editor-", suffix=".txt",
732 (fd, name) = tempfile.mkstemp(prefix="hg-editor-", suffix=".txt",
733 text=True)
733 text=True)
734 try:
734 try:
@@ -743,6 +743,8 b' class ui(object):'
743 if label in extra:
743 if label in extra:
744 environ.update({'HGREVISION': extra[label]})
744 environ.update({'HGREVISION': extra[label]})
745 break
745 break
746 if editform:
747 environ.update({'HGEDITFORM': editform})
746
748
747 editor = self.geteditor()
749 editor = self.geteditor()
748
750
@@ -4,7 +4,12 b' commit date test'
4 $ cd test
4 $ cd test
5 $ echo foo > foo
5 $ echo foo > foo
6 $ hg add foo
6 $ hg add foo
7 $ HGEDITOR=true hg commit -m ""
7 $ cat > $TESTTMP/checkeditform.sh <<EOF
8 > env | grep HGEDITFORM
9 > true
10 > EOF
11 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg commit -m ""
12 HGEDITFORM=commit.normal
8 abort: empty commit message
13 abort: empty commit message
9 [255]
14 [255]
10 $ hg commit -d '0 0' -m commit-1
15 $ hg commit -d '0 0' -m commit-1
General Comments 0
You need to be logged in to leave comments. Login now