=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/update.c,v retrieving revision 1.118 retrieving revision 1.119 diff -u -r1.118 -r1.119 --- src/usr.bin/cvs/update.c 2008/02/03 15:20:10 1.118 +++ src/usr.bin/cvs/update.c 2008/02/04 15:07:33 1.119 @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.118 2008/02/03 15:20:10 tobias Exp $ */ +/* $OpenBSD: update.c,v 1.119 2008/02/04 15:07:33 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink * @@ -32,6 +32,8 @@ int reset_stickies = 0; char *cvs_specified_tag = NULL; +static char *koptstr; + static void update_clear_conflict(struct cvs_file *); struct cvs_cmd cvs_cmd_update = { @@ -74,6 +76,13 @@ case 'j': break; case 'k': + koptstr = optarg; + kflag = rcs_kflag_get(koptstr); + if (RCS_KWEXP_INVAL(kflag)) { + cvs_log(LP_ERR, + "invalid RCS keyword expension mode"); + fatal("%s", cvs_cmd_add.cmd_synopsis); + } break; case 'l': flags &= ~CR_RECURSE_DIRS; @@ -115,6 +124,8 @@ cvs_client_send_request("Argument -A"); if (build_dirs) cvs_client_send_request("Argument -d"); + if (kflag) + cvs_client_send_request("Argument -k%s", koptstr); if (!(flags & CR_RECURSE_DIRS)) cvs_client_send_request("Argument -l"); if (prune_dirs) @@ -280,7 +291,7 @@ char *tag; int ret, flags; CVSENTRIES *entlist; - char rbuf[CVS_REV_BUFSZ]; + char kbuf[8], rbuf[CVS_REV_BUFSZ]; cvs_log(LP_TRACE, "cvs_update_local(%s)", cf->file_path); @@ -305,6 +316,9 @@ cvs_file_classify(cf, tag); + if (kflag) + rcs_kwexp_set(cf->file_rcs, kflag); + if (cf->file_ent != NULL && cf->file_ent->ce_tag != NULL) tag = cf->file_ent->ce_tag; @@ -337,6 +351,22 @@ return; } + if (cf->file_ent != NULL) { + if (cf->file_ent->ce_opts == NULL) { + if (kflag) + cf->file_status = FILE_CHECKOUT; + } else { + if (kflag) { + (void)xsnprintf(kbuf, sizeof(kbuf), + "-k%s", cf->file_rcs->rf_expand); + + if (strcmp(kbuf, cf->file_ent->ce_opts)) + cf->file_status = FILE_CHECKOUT; + } else if (reset_stickies) + cf->file_status = FILE_CHECKOUT; + } + } + switch (cf->file_status) { case FILE_UNKNOWN: cvs_printf("? %s\n", cf->file_path); @@ -425,8 +455,9 @@ rcsnum_tostr(cf->file_ent->ce_rev, revbuf, sizeof(revbuf)); entry = xmalloc(CVS_ENT_MAXLINELEN); - (void)xsnprintf(entry, CVS_ENT_MAXLINELEN, "/%s/%s/%s//", - cf->file_name, revbuf, timebuf); + (void)xsnprintf(entry, CVS_ENT_MAXLINELEN, "/%s/%s/%s/%s/%s", + cf->file_name, revbuf, timebuf, cf->file_ent->ce_opts ? : "", + cf->file_ent->ce_tag ? : ""); entlist = cvs_ent_open(cf->file_wd); cvs_ent_add(entlist, entry);