diff options
-rw-r--r-- | usr.bin/cvs/checkout.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/commit.c | 13 | ||||
-rw-r--r-- | usr.bin/cvs/config.h | 3 | ||||
-rw-r--r-- | usr.bin/cvs/modules.c | 17 |
4 files changed, 30 insertions, 7 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c index a4035f1420b..cdf63aa7ed8 100644 --- a/usr.bin/cvs/checkout.c +++ b/usr.bin/cvs/checkout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: checkout.c,v 1.127 2008/02/04 21:29:17 joris Exp $ */ +/* $OpenBSD: checkout.c,v 1.128 2008/02/04 22:36:40 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -298,7 +298,7 @@ checkout_check_repository(int argc, char **argv) } if (nflag != 1 && mc->mc_prog != NULL && - mc->mc_flags & MODULE_RUN_ON_COMMIT) + mc->mc_flags & MODULE_RUN_ON_CHECKOUT) cvs_exec(mc->mc_prog); } diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c index bbc302e1797..48116852fcc 100644 --- a/usr.bin/cvs/commit.c +++ b/usr.bin/cvs/commit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commit.c,v 1.126 2008/02/04 15:07:33 tobias Exp $ */ +/* $OpenBSD: commit.c,v 1.127 2008/02/04 22:36:40 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> @@ -54,10 +54,11 @@ struct cvs_cmd cvs_cmd_commit = { int cvs_commit(int argc, char **argv) { - int ch, Fflag, mflag; - char *arg = "."; int flags; + int ch, Fflag, mflag; + struct module_checkout *mc; struct cvs_recursion cr; + char *arg = ".", repo[MAXPATHLEN]; flags = CR_RECURSE_DIRS; Fflag = mflag = 0; @@ -156,6 +157,12 @@ cvs_commit(int argc, char **argv) cr.fileproc = cvs_commit_local; cvs_file_walklist(&files_affected, &cr); cvs_file_freelist(&files_affected); + + cvs_get_repository_name(".", repo, MAXPATHLEN); + mc = cvs_module_lookup(repo); + if (mc->mc_prog != NULL && + (mc->mc_flags & MODULE_RUN_ON_COMMIT)) + cvs_exec(mc->mc_prog); } xfree(logmsg); diff --git a/usr.bin/cvs/config.h b/usr.bin/cvs/config.h index ac0c3390da3..6946ef3b7a5 100644 --- a/usr.bin/cvs/config.h +++ b/usr.bin/cvs/config.h @@ -1,4 +1,4 @@ -/* $OpenBSD: config.h,v 1.7 2008/02/04 19:08:32 joris Exp $ */ +/* $OpenBSD: config.h,v 1.8 2008/02/04 22:36:40 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -35,6 +35,7 @@ void modules_parse_line(char *, int); #define MODULE_TARGETDIR 0x02 #define MODULE_NORECURSE 0x04 #define MODULE_RUN_ON_COMMIT 0x08 +#define MODULE_RUN_ON_CHECKOUT 0x10 struct module_checkout { char *mc_name; diff --git a/usr.bin/cvs/modules.c b/usr.bin/cvs/modules.c index 1af50afb71d..6d271b3bb8b 100644 --- a/usr.bin/cvs/modules.c +++ b/usr.bin/cvs/modules.c @@ -1,4 +1,4 @@ -/* $OpenBSD: modules.c,v 1.7 2008/02/04 19:08:32 joris Exp $ */ +/* $OpenBSD: modules.c,v 1.8 2008/02/04 22:36:40 joris Exp $ */ /* * Copyright (c) 2008 Joris Vink <joris@openbsd.org> * @@ -97,6 +97,21 @@ modules_parse_line(char *line, int lineno) case 'l': flags |= MODULE_NORECURSE; break; + case 'o': + if (flags != 0 || prog != NULL) { + cvs_log(LP_NOTICE, + "-o cannot be used with other flags"); + return; + } + + if ((val = strchr(p, ' ' )) == NULL) + goto bad; + + *(val++) = '\0'; + prog = xstrdup(p); + p = val; + flags |= MODULE_RUN_ON_CHECKOUT; + break; case 'i': if (flags != 0 || prog != NULL) { cvs_log(LP_NOTICE, |