Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 20606:be140ebd506b
ui: edit(): transplant: set HGREVISION environment variable for an editor
transplant command set 'transplant_source' extra for the revision.
Allow an editor to access the extra using HGREVISION environment variable.
This may be useful when an editor is actually a script which modifies a commit
message. Transplant filters is an alternative way to do it.
author | Alexander Drozdov <al.drozdov@gmail.com> |
---|---|
date | Mon, 10 Feb 2014 07:13:10 +0400 |
parents | a8aa699a812a |
children | be179da10d5f |
comparison
equal
deleted
inserted
replaced
20605:a8aa699a812a | 20606:be140ebd506b |
---|---|
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from i18n import _ | 8 from i18n import _ |
9 import errno, getpass, os, socket, sys, tempfile, traceback | 9 import errno, getpass, os, socket, sys, tempfile, traceback |
10 import config, scmutil, util, error, formatter | 10 import config, scmutil, util, error, formatter |
11 from node import hex | |
11 | 12 |
12 class ui(object): | 13 class ui(object): |
13 def __init__(self, src=None): | 14 def __init__(self, src=None): |
14 self._buffers = [] | 15 self._buffers = [] |
15 self.quiet = self.verbose = self.debugflag = self.tracebackflag = False | 16 self.quiet = self.verbose = self.debugflag = self.tracebackflag = False |
721 f = os.fdopen(fd, "w") | 722 f = os.fdopen(fd, "w") |
722 f.write(text) | 723 f.write(text) |
723 f.close() | 724 f.close() |
724 | 725 |
725 environ = {'HGUSER': user} | 726 environ = {'HGUSER': user} |
727 if 'transplant_source' in extra: | |
728 environ.update({'HGREVISION': hex(extra['transplant_source'])}) | |
726 for label in ('source', 'rebase_source'): | 729 for label in ('source', 'rebase_source'): |
727 if label in extra: | 730 if label in extra: |
728 environ.update({'HGREVISION': extra[label]}) | 731 environ.update({'HGREVISION': extra[label]}) |
729 break | 732 break |
730 | 733 |