comparison mercurial/ui.py @ 20605:a8aa699a812a

ui: edit(): rebase, graft: set HGREVISION environment variable for an editor rebase and graft commands set 'rebase_source' or 'source' extras for the revision. Allow an editor to access the extras using HGREVISION environment variable. This may be useful when an editor is actually a script which modifies a commit message. The name 'HGREVISION' has been selected as transplant already sets this variable for its filters (--filter).
author Alexander Drozdov <al.drozdov@gmail.com>
date Thu, 06 Feb 2014 12:21:20 +0400
parents cc76c619bed6
children be140ebd506b
comparison
equal deleted inserted replaced
20604:4991cfc90f59 20605:a8aa699a812a
720 try: 720 try:
721 f = os.fdopen(fd, "w") 721 f = os.fdopen(fd, "w")
722 f.write(text) 722 f.write(text)
723 f.close() 723 f.close()
724 724
725 environ = {'HGUSER': user}
726 for label in ('source', 'rebase_source'):
727 if label in extra:
728 environ.update({'HGREVISION': extra[label]})
729 break
730
725 editor = self.geteditor() 731 editor = self.geteditor()
726 732
727 util.system("%s \"%s\"" % (editor, name), 733 util.system("%s \"%s\"" % (editor, name),
728 environ={'HGUSER': user}, 734 environ=environ,
729 onerr=util.Abort, errprefix=_("edit failed"), 735 onerr=util.Abort, errprefix=_("edit failed"),
730 out=self.fout) 736 out=self.fout)
731 737
732 f = open(name) 738 f = open(name)
733 t = f.read() 739 t = f.read()