=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/file.c,v retrieving revision 1.198 retrieving revision 1.199 diff -c -r1.198 -r1.199 *** src/usr.bin/cvs/file.c 2007/09/22 15:57:24 1.198 --- src/usr.bin/cvs/file.c 2007/09/22 16:01:22 1.199 *************** *** 1,4 **** ! /* $OpenBSD: file.c,v 1.198 2007/09/22 15:57:24 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * Copyright (c) 2004 Jean-Francois Brousseau --- 1,4 ---- ! /* $OpenBSD: file.c,v 1.199 2007/09/22 16:01:22 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * Copyright (c) 2004 Jean-Francois Brousseau *************** *** 74,79 **** --- 74,80 ---- "*$", }; + char *cvs_directory_tag = NULL; struct ignore_head cvs_ign_pats; struct ignore_head dir_ign_pats; *************** *** 180,193 **** TAILQ_INIT(&fl); for (i = 0; i < argc; i++) ! cvs_file_get(argv[i], &fl); cvs_file_walklist(&fl, cr); cvs_file_freelist(&fl); } struct cvs_filelist * ! cvs_file_get(const char *name, struct cvs_flisthead *fl) { const char *p; struct cvs_filelist *l; --- 181,194 ---- TAILQ_INIT(&fl); for (i = 0; i < argc; i++) ! cvs_file_get(argv[i], 1, &fl); cvs_file_walklist(&fl, cr); cvs_file_freelist(&fl); } struct cvs_filelist * ! cvs_file_get(const char *name, int check_dir_tag, struct cvs_flisthead *fl) { const char *p; struct cvs_filelist *l; *************** *** 201,206 **** --- 202,208 ---- l = (struct cvs_filelist *)xmalloc(sizeof(*l)); l->file_path = xstrdup(p); + l->check_dir_tag = check_dir_tag; TAILQ_INSERT_TAIL(fl, l, flist); return (l); *************** *** 319,324 **** --- 321,335 ---- if (cf->file_type == CVS_DIR) { cvs_file_walkdir(cf, cr); } else { + if (l->check_dir_tag) { + cvs_parse_tagfile(cf->file_wd, + &cvs_directory_tag, NULL, NULL); + + if (cvs_directory_tag == NULL && + cvs_specified_tag != NULL) + cvs_directory_tag = cvs_specified_tag; + } + if (cr->fileproc != NULL) cr->fileproc(cf); } *************** *** 376,381 **** --- 387,394 ---- return; } + cvs_parse_tagfile(cf->file_path, &cvs_directory_tag, NULL, NULL); + /* * check for a local .cvsignore file */ *************** *** 476,485 **** switch (type) { case CVS_DIR: if (cr->flags & CR_RECURSE_DIRS) ! cvs_file_get(fpath, &dl); break; case CVS_FILE: ! cvs_file_get(fpath, &fl); break; default: fatal("type %d unknown, shouldn't happen", --- 489,498 ---- switch (type) { case CVS_DIR: if (cr->flags & CR_RECURSE_DIRS) ! cvs_file_get(fpath, 0, &dl); break; case CVS_FILE: ! cvs_file_get(fpath, 0, &fl); break; default: fatal("type %d unknown, shouldn't happen", *************** *** 512,520 **** ent->ce_type == CVS_ENT_DIR) continue; if (ent->ce_type == CVS_ENT_DIR) ! cvs_file_get(fpath, &dl); else if (ent->ce_type == CVS_ENT_FILE) ! cvs_file_get(fpath, &fl); cvs_ent_free(ent); } --- 525,533 ---- ent->ce_type == CVS_ENT_DIR) continue; if (ent->ce_type == CVS_ENT_DIR) ! cvs_file_get(fpath, 0, &dl); else if (ent->ce_type == CVS_ENT_FILE) ! cvs_file_get(fpath, 0, &fl); cvs_ent_free(ent); } *************** *** 540,545 **** --- 553,564 ---- if (cr->leavedir != NULL) cr->leavedir(cf); + + if (cvs_directory_tag != NULL) { + cvs_write_tagfile(cf->file_path, cvs_directory_tag, NULL, 0); + xfree(cvs_directory_tag); + cvs_directory_tag = NULL; + } } void *************** *** 560,566 **** size_t len; struct stat st; BUF *b1, *b2; ! int server_has_file; int rflags, ismodified, rcsdead; CVSENTRIES *entlist = NULL; const char *state; --- 579,585 ---- size_t len; struct stat st; BUF *b1, *b2; ! int server_has_file, notag; int rflags, ismodified, rcsdead; CVSENTRIES *entlist = NULL; const char *state; *************** *** 647,663 **** } } if (tag != NULL && cf->file_rcs != NULL) { ! /* if we could not translate tag, means that we should ! * skip this file. */ ! if ((cf->file_rcsrev = rcs_translate_tag(tag, cf->file_rcs)) == NULL) { ! cf->file_status = FILE_SKIP; ! cvs_ent_close(entlist, ENT_NOSYNC); ! return; } - - rcsnum_tostr(cf->file_rcsrev, r1, sizeof(r1)); - } else if (cf->file_ent != NULL && cf->file_ent->ce_tag != NULL) { cf->file_rcsrev = rcsnum_alloc(); rcsnum_cpy(cf->file_ent->ce_rev, cf->file_rcsrev, 0); --- 666,680 ---- } } + notag = 0; if (tag != NULL && cf->file_rcs != NULL) { ! if ((cf->file_rcsrev = rcs_translate_tag(tag, ! cf->file_rcs)) != NULL) { ! rcsnum_tostr(cf->file_rcsrev, r1, sizeof(r1)); ! } else { ! notag = 1; ! cf->file_rcsrev = rcs_head_get(cf->file_rcs); } } else if (cf->file_ent != NULL && cf->file_ent->ce_tag != NULL) { cf->file_rcsrev = rcsnum_alloc(); rcsnum_cpy(cf->file_ent->ce_rev, cf->file_rcsrev, 0); *************** *** 737,744 **** } else if (cvs_cmdop != CVS_OP_ADD) { cf->file_status = FILE_UNKNOWN; } ! } else { cf->file_status = FILE_CHECKOUT; } } else if (cf->file_ent->ce_status == CVS_ENT_ADDED) { if (cf->fd == -1) { --- 754,763 ---- } else if (cvs_cmdop != CVS_OP_ADD) { cf->file_status = FILE_UNKNOWN; } ! } else if (notag == 0) { cf->file_status = FILE_CHECKOUT; + } else { + cf->file_status = FILE_UPTODATE; } } else if (cf->file_ent->ce_status == CVS_ENT_ADDED) { if (cf->fd == -1) { *************** *** 777,783 **** } } else if (cf->file_ent->ce_status == CVS_ENT_REG) { if (cf->file_rcs == NULL || rcsdead == 1 || ! (reset_stickies == 1 && cf->in_attic == 1)) { if (cf->fd == -1 && server_has_file == 0) { cvs_log(LP_NOTICE, "warning: %s's entry exists but" --- 796,803 ---- } } else if (cf->file_ent->ce_status == CVS_ENT_REG) { if (cf->file_rcs == NULL || rcsdead == 1 || ! (reset_stickies == 1 && cf->in_attic == 1) || ! (notag == 1 && tag != NULL)) { if (cf->fd == -1 && server_has_file == 0) { cvs_log(LP_NOTICE, "warning: %s's entry exists but"