changeset 46369:0760282995cf stable

hooks: add some test about HGPLAIN setting and hooks 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. Differential Revision: https://phab.mercurial-scm.org/D9979
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 10 Feb 2021 22:43:16 +0100
parents 86b019899737
children 7289eac777ec
files tests/test-hook.t
diffstat 1 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-hook.t	Wed Feb 10 21:05:05 2021 +0100
+++ b/tests/test-hook.t	Wed Feb 10 22:43:16 2021 +0100
@@ -1390,3 +1390,30 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     a
   
+
+unsetup the test
+----------------
+
+# touch the file to unconfuse chg with a diffrent mtime
+  $ sleep 1
+  $ touch $TESTTMP/untrusted.py
+  $ 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)