Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 22205:9fa429723f26
ui: invoke editor for committing with HGEDITFORM environment variable
At the external editor invocation for committing, the value specified
as "editform" for "cmdutil.getcommiteditor" is in "HGEDITFORM".
This enables external editor to do own customization according to
commit types.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 15 Aug 2014 23:05:53 +0900 |
parents | 6dfb78f18bdb |
children | 3b39e1522d8f |
comparison
equal
deleted
inserted
replaced
22204:f8dc6599da5d | 22205:9fa429723f26 |
---|---|
726 This adds an output label of "ui.debug". | 726 This adds an output label of "ui.debug". |
727 ''' | 727 ''' |
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: |
735 f = os.fdopen(fd, "w") | 735 f = os.fdopen(fd, "w") |
736 f.write(text) | 736 f.write(text) |
741 environ.update({'HGREVISION': hex(extra['transplant_source'])}) | 741 environ.update({'HGREVISION': hex(extra['transplant_source'])}) |
742 for label in ('source', 'rebase_source'): | 742 for label in ('source', 'rebase_source'): |
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 |
749 util.system("%s \"%s\"" % (editor, name), | 751 util.system("%s \"%s\"" % (editor, name), |
750 environ=environ, | 752 environ=environ, |