Patchwork D9979: hooks: add some test about HGPLAIN setting and hooks

login
register
mail settings
Submitter phabricator
Date Feb. 10, 2021, 11:47 p.m.
Message ID <differential-rev-PHID-DREV-4j5yvvt5az5w5rhzv4oe-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48294/
State Superseded
Headers show

Comments

phabricator - Feb. 10, 2021, 11:47 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In Mercurial 5.7, hooks are now ran with HGPLAIN set, which is a behavior change
  in. I could not find explicit test about it so I am adding one. The next
  changesets will introduce more change to help user mitigate the behavior change
  when needed.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  tests/test-hook.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -1390,3 +1390,26 @@ 
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     a
   
+
+unsetup the test
+----------------
+  $ cat << EOF >> $HGRCPATH
+  > [extensions]
+  > untrusted=!
+  > EOF
+
+HGPLAIN setting in hooks
+========================
+
+  $ cat << EOF >> .hg/hgrc
+  > [hooks]
+  > pre-version.testing-default=echo '### default ###' plain: \$HGPLAIN
+  > EOF
+
+  $ (unset HGPLAIN; hg version --quiet)
+  ### default ### plain: 1
+  Mercurial Distributed SCM (*) (glob)
+
+  $ HGPLAIN=1 hg version --quiet
+  ### default ### plain: 1
+  Mercurial Distributed SCM (*) (glob)