Hook ordering - behaviour change.
Aravind Gottipati
aravind at freeshell.org
Tue Aug 3 22:14:36 UTC 2010
On Tue, Aug 3, 2010 at 10:50 AM, Matt Mackall <mpm at selenic.com> wrote:
> Seems promising. Probably belongs under [hooks] somehow though. If we
> guarantee that we'll never have a hook named 'sort', I think we can just
> use that.
>
This patch should do that. To be consistent with the rest of the
variable names, I changed the variable name to "sorthooks". Setting
sorthooks = True, will make Mercurial sort the hooks before applying
them. Setting it to False or omitting it defaults to the current
behavior. I have tested this against 1.5.4 (and it should work
against tip as well).
Aravind.
diff -r a614666bbba4 mercurial/hook.py
--- a/mercurial/hook.py Mon Aug 02 13:31:43 2010 -0500
+++ b/mercurial/hook.py Tue Aug 03 15:13:32 2010 -0700
@@ -127,7 +127,10 @@
os.dup2(stderrno, stdoutno)
try:
- for hname, cmd in ui.configitems('hooks'):
+ allhooks = ui.configitems('hooks')
+ if ('sorthooks', 'True') in allhooks:
+ allhooks = sorted(allhooks)
+ for hname, cmd in allhooks:
if hname.split('.')[0] != name or not cmd:
continue
if hasattr(cmd, '__call__'):
More information about the Mercurial-devel
mailing list