diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2007-01-01 23:49:07 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2007-01-01 23:49:07 +0000 |
commit | dccbe45dc3680e125747c023d603ecca0bd94a9c (patch) | |
tree | 1c2703069863f5d4b3eadcf6ea358b9a1ddf56e7 /usr.bin/cvs/admin.c | |
parent | 3e2eb84bb68afd332f63f809f146e3df3865e447 (diff) |
add support for [-s state[:rev]]
Diffstat (limited to 'usr.bin/cvs/admin.c')
-rw-r--r-- | usr.bin/cvs/admin.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/usr.bin/cvs/admin.c b/usr.bin/cvs/admin.c index 4fa6bd0bdb9..ae346847b18 100644 --- a/usr.bin/cvs/admin.c +++ b/usr.bin/cvs/admin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: admin.c,v 1.41 2006/12/31 15:38:11 xsa Exp $ */ +/* $OpenBSD: admin.c,v 1.42 2007/01/01 23:49:06 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2005 Joris Vink <joris@openbsd.org> @@ -43,7 +43,7 @@ struct cvs_cmd cvs_cmd_admin = { static int runflags = 0; static int lkmode = RCS_LOCK_INVAL; -static char *alist, *comment, *elist, *logmsg, *logstr, *orange; +static char *alist, *comment, *elist, *logmsg, *logstr, *orange, *state, *statestr; static RCSNUM *logrev; int @@ -55,7 +55,7 @@ cvs_admin(int argc, char **argv) flags = CR_RECURSE_DIRS; - alist = comment = elist = logmsg = logstr = orange = NULL; + alist = comment = elist = logmsg = logstr = orange = state = statestr = NULL; while ((ch = getopt(argc, argv, cvs_cmd_admin.cmd_opts)) != -1) { switch (ch) { @@ -100,6 +100,7 @@ cvs_admin(int argc, char **argv) verbosity = 0; break; case 's': + statestr = optarg; break; case 't': break; @@ -150,6 +151,9 @@ cvs_admin(int argc, char **argv) if (orange != NULL) cvs_client_send_request("Argument -o%s", orange); + if (statestr != NULL) + cvs_client_send_request("Argument -s%s", statestr); + if (verbosity == 0) cvs_client_send_request("Argument -q"); @@ -276,6 +280,38 @@ cvs_admin_local(struct cvs_file *cf) } } + if (statestr != NULL) { + struct cvs_argvector *sargv; + + sargv = cvs_strsplit(statestr, ":"); + if (sargv->argv[1] != NULL) { + state = xstrdup(sargv->argv[0]); + + if ((logrev = rcsnum_parse(sargv->argv[1])) == NULL) { + cvs_log(LP_ERR, "`%s' bad revision number", statestr); + return; + } + } else { + state = xstrdup(statestr); + logrev = rcsnum_alloc(); + rcsnum_cpy(cf->file_rcs->rf_head, logrev, 0); + } + + if (rcs_state_check(state) < 0) { + cvs_log(LP_ERR, "invalid state `%s'", state); + cvs_argv_destroy(sargv); + rcsnum_free(logrev); + xfree(state); + return; + } + + (void)rcs_state_set(cf->file_rcs, logrev, state); + + cvs_argv_destroy(sargv); + rcsnum_free(logrev); + xfree(state); + } + if (lkmode != RCS_LOCK_INVAL) (void)rcs_lock_setmode(cf->file_rcs, lkmode); |