Patchwork D9605: hook: set `HGPLAIN=1` for external hooks

login
register
mail settings
Submitter phabricator
Date Dec. 15, 2020, 12:37 a.m.
Message ID <differential-rev-PHID-DREV-27pcbrfmev44wq5eg7kw-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47902/
State Superseded
Headers show

Comments

phabricator - Dec. 15, 2020, 12:37 a.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  External hooks will probably turn around and run hg commands, so this seems like
  a reasonable convenience for people who miss it in the documentation.
  
  There are no test changes because `printenv.py` filters out anything without a
  "HG_" prefix.  It wouldn't be a useful test anyway, because this is already
  inherited from the test environment.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9605

AFFECTED FILES
  mercurial/hook.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -157,6 +157,7 @@ 
             env[b'HG_PENDING'] = repo.root
     env[b'HG_HOOKTYPE'] = htype
     env[b'HG_HOOKNAME'] = name
+    env[b'HGPLAIN'] = b'1'
 
     for k, v in pycompat.iteritems(args):
         # transaction changes can accumulate MBs of data, so skip it