marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  That setting restore the behavior pre-5.6. The current HGPLAIN value is simply
  passed to the hooks.
  
  This allow user who needs it to fully mitigate the behavior change introduced
  in Mercurial 5.7 by restoring the older behavior.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/hook.py
  tests/test-hook.t

CHANGE DETAILS

diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -1408,16 +1408,20 @@
   > pre-version.testing-yes:run-with-plain=yes
   > pre-version.testing-no=echo '### no ########' plain: \$HGPLAIN
   > pre-version.testing-no:run-with-plain=no
+  > pre-version.testing-auto=echo '### auto ######' plain: \$HGPLAIN
+  > pre-version.testing-auto:run-with-plain=auto
   > EOF
 
   $ (unset HGPLAIN; hg version --quiet)
   ### default ### plain: 1
   ### yes ####### plain: 1
   ### no ######## plain:
+  ### auto ###### plain:
   Mercurial Distributed SCM (*) (glob)
 
   $ HGPLAIN=1 hg version --quiet
   ### default ### plain: 1
   ### yes ####### plain: 1
   ### no ######## plain:
+  ### auto ###### plain: 1
   Mercurial Distributed SCM (*) (glob)
diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -158,7 +158,10 @@
     env[b'HG_HOOKTYPE'] = htype
     env[b'HG_HOOKNAME'] = name
 
-    plain = ui.configbool(b'hooks', b'%s:run-with-plain' % name)
+    if ui.config(b'hooks', b'%s:run-with-plain' % name) == b'auto':
+        plain = ui.plain()
+    else:
+        plain = ui.configbool(b'hooks', b'%s:run-with-plain' % name)
     if plain:
         env[b'HGPLAIN'] = b'1'
     else:



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to