githelper.git/
githelper.pike
Branch:
Tag:
Non-build tags
All tags
No tags
2010-09-25
2010-09-25 13:09:17 by Marcus Comstedt <marcus@mc.pp.se>
5179185c9d7dc4cbf24d73154a6a167905357c94 (
16
lines) (+
10
/-
6
)
[
Show
|
Annotate
]
Branch:
master
Replace PostCheckoutHook with PreCommitHook.
1:
#! /usr/bin/env pike constant hooks = ([
-
"
post
-
checkout
" :
PostCheckoutHook
,
+
"
pre
-
commit
" :
PreCommitHook
,
]); constant filters = ([
45:
/* Hooks */
-
class
PostCheckoutHook
+
/* Checks run before editing a commit message */
+
+
class
PreCommitHook
{
-
int hook(
string old_head, string new_head, string branchflag
)
+
int hook()
{
-
write("
post
-
checkout: old=%s, new=%s, branch=%d\n
"
,
-
old_head, new_head, (int
)
branchflag)
;
+
write("
pre
-
commit\n
");
return 0; } } /* Filters */
-
+
/* A sample filter, not really useful... */
+
class NiceIdentFilter { static string replace_id(string f, function(string:string) replace) {
125:
} else if (s->islnk) { /* Already setup ok, it seems */ } else {
-
write("Hook %s already exists, so won't overwrite it...", name);
+
write("Hook %s already exists, so won't overwrite it...
\n
", name);
} } }