From patchwork Fri Feb 7 04:26:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4, of, 4] ui: edit(): transplant: set HGREVISION environment variable for an editor From: Alexander Drozdov X-Patchwork-Id: 3509 Message-Id: <8b9f2ec2dde1e08580bd.1391747161@localhost6.localdomain6> To: mercurial-devel@selenic.com Date: Fri, 07 Feb 2014 08:26:01 +0400 # HG changeset patch # User Alexander Drozdov # Date 1391746185 -14400 # Fri Feb 07 08:09:45 2014 +0400 # Node ID 8b9f2ec2dde1e08580bd5893ce6253acc940a837 # Parent 01079ca49c16f7c0c3d53ba673f424368aea075e 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. diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -8,6 +8,7 @@ from i18n import _ import errno, getpass, os, socket, sys, tempfile, traceback import config, scmutil, util, error, formatter +from node import hex class ui(object): def __init__(self, src=None): @@ -721,6 +722,10 @@ f.close() environ = {'HGUSER': user} + for label in ('transplant_source',): + if label in extra: + environ.update({'HGREVISION': hex(extra[label])}) + break for label in ('source', 'rebase_source'): if label in extra: environ.update({'HGREVISION': extra[label]})