diff tests/test-hook.t @ 15896:30c34fde40cc

hooks: prioritize run order of hooks As of Mercurial 1.3, hooks are sorted in the order they are read into Mercurial. There are many instances when someone may want the hooks sorted in a specific order; this patch allows prioritizing hooks, while maintaining the existing enumeration for hooks without a priority.
author Matt Zuba <matt.zuba@goodwillaz.org>
date Sun, 15 Jan 2012 13:50:12 -0700
parents e69a3cdad37e
children 4091660dc130
line wrap: on
line diff
--- a/tests/test-hook.t	Sun Jan 15 18:00:01 2012 -0600
+++ b/tests/test-hook.t	Sun Jan 15 13:50:12 2012 -0700
@@ -553,3 +553,19 @@
   calling hook pre-identify: hooktests.verbosehook
   verbose output from hook
   cb9a9f314b8b
+
+Ensure hooks can be prioritized
+
+  $ echo '[hooks]' > .hg/hgrc
+  $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc
+  $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc
+  $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc
+  $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc
+  $ hg id --verbose
+  calling hook pre-identify.b: hooktests.verbosehook
+  verbose output from hook
+  calling hook pre-identify.a: hooktests.verbosehook
+  verbose output from hook
+  calling hook pre-identify.c: hooktests.verbosehook
+  verbose output from hook
+  cb9a9f314b8b