[PATCH 3 of 4] ui: edit(): rebase, graft: set HGREVISION environment variable for an editor
Alexander Drozdov
al.drozdov at gmail.com
Thu Feb 6 22:26:00 CST 2014
# HG changeset patch
# User Alexander Drozdov <al.drozdov at gmail.com>
# Date 1391674880 -14400
# Thu Feb 06 12:21:20 2014 +0400
# Node ID 01079ca49c16f7c0c3d53ba673f424368aea075e
# Parent 441c5f6d5e7d8c047311f6a0e8bc4012520009b3
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.
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -720,10 +720,16 @@
f.write(text)
f.close()
+ environ = {'HGUSER': user}
+ for label in ('source', 'rebase_source'):
+ if label in extra:
+ environ.update({'HGREVISION': extra[label]})
+ break
+
editor = self.geteditor()
util.system("%s \"%s\"" % (editor, name),
- environ={'HGUSER': user},
+ environ=environ,
onerr=util.Abort, errprefix=_("edit failed"),
out=self.fout)
More information about the Mercurial-devel
mailing list