diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2007-07-03 13:22:44 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2007-07-03 13:22:44 +0000 |
commit | bd5e0281b3317c92d15c4e781c2c3df1c90827d1 (patch) | |
tree | b60313fa62ffbfe07b7c94dfacc59e7b1f468368 /usr.bin | |
parent | 0a517d4100b3c41e5336ee809374a2e7e0e7249e (diff) |
Rework the way opencvs works in relation to files in the Attic/:
Previously, files in the 'Attic/' were linked into our filelist as being
'Attic/filename,v' this caused unneeded stress on certain functions
like cvs_file_classify() who had to do pointer voodoo to split out
the 'Attic/' part and do other very weird stuff to normalize the pathname
of these files.
Instead, we handle these files early in the start when we
build the fileslist in cvs_repository_getdir(). When encountering
the 'Attic/' directory, we recurse in it if required but instead of
using the 'Attic/' directory component as our base directory we stick
with the directory name where 'Attic/' resides in, resulting in the
correct filename while maintaining the correct RCSpath for the file.
This made the following things a lot easier:
(and in most cases actually fixed the below points)
- status with files in Attic/.
- checking out HEAD repositories with files in Attic/.
- checking out repositories with -rTAG.
- updating with -rTAG.
and as an added bonus the following now also works:
- correctly creating CVS/Tag in both local and remote mode thus
allowing update/status/and more to work correctly with the tagged tree.
(thanks to the correct handling of -rTAG cases).
- resetting tags with opencvs -A properly works too now.
This is a major step forward into the usability
of OpenCVS when it comes to maintaining multiple tagged trees, the next
logical step would be to fix commiting to branches.
enjoy you -stable cowards.
tested by myself, xsa, niallo and ckuethe
thanks guys!
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/checkout.c | 26 | ||||
-rw-r--r-- | usr.bin/cvs/client.c | 21 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.h | 4 | ||||
-rw-r--r-- | usr.bin/cvs/entries.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/file.c | 57 | ||||
-rw-r--r-- | usr.bin/cvs/history.c | 5 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/remote.h | 4 | ||||
-rw-r--r-- | usr.bin/cvs/repository.c | 7 | ||||
-rw-r--r-- | usr.bin/cvs/server.c | 37 | ||||
-rw-r--r-- | usr.bin/cvs/update.c | 31 | ||||
-rw-r--r-- | usr.bin/cvs/util.c | 12 | ||||
-rw-r--r-- | usr.bin/cvs/util.h | 4 |
13 files changed, 136 insertions, 83 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c index e523fe727ce..58d8384b089 100644 --- a/usr.bin/cvs/checkout.c +++ b/usr.bin/cvs/checkout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: checkout.c,v 1.96 2007/06/28 21:38:09 xsa Exp $ */ +/* $OpenBSD: checkout.c,v 1.97 2007/07/03 13:22:42 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -33,8 +33,6 @@ static void checkout_repository(const char *, const char *); extern int prune_dirs; extern int build_dirs; -extern int reset_stickies; -extern char *tag; static int flags = CR_REPO | CR_RECURSE_DIRS; @@ -78,7 +76,7 @@ cvs_checkout(int argc, char **argv) case 'R': break; case 'r': - tag = xstrdup(optarg); + cvs_specified_tag = optarg; break; default: fatal("%s", cvs_cmd_checkout.cmd_synopsis); @@ -137,8 +135,9 @@ checkout_check_repository(int argc, char **argv) if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { cvs_client_connect_to_server(); - if (tag != NULL) - cvs_client_send_request("Argument -r%s", tag); + if (cvs_specified_tag != NULL) + cvs_client_send_request("Argument -r%s", + cvs_specified_tag); if (reset_stickies == 1) cvs_client_send_request("Argument -A"); @@ -175,7 +174,8 @@ checkout_check_repository(int argc, char **argv) argv[i]); continue; } - cvs_mkpath(argv[i]); + + cvs_mkpath(argv[i], cvs_specified_tag); checkout_repository(repo, argv[i]); } } @@ -217,7 +217,7 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, int co_flags) CVSENTRIES *ent; struct timeval tv[2]; char *tosend; - char template[MAXPATHLEN], *p, entry[CVS_ENT_MAXLINELEN]; + char template[MAXPATHLEN], entry[CVS_ENT_MAXLINELEN]; char kbuf[8], stickytag[32], rev[CVS_REV_BUFSZ]; char timebuf[CVS_TIME_BUFSZ], tbuf[CVS_TIME_BUFSZ]; @@ -291,9 +291,9 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, int co_flags) } if (co_flags & CO_SETSTICKY) - if (tag != NULL) + if (cvs_specified_tag != NULL) (void)xsnprintf(stickytag, sizeof(stickytag), "T%s", - tag); + cvs_specified_tag); else (void)xsnprintf(stickytag, sizeof(stickytag), "T%s", rev); @@ -321,9 +321,6 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, int co_flags) cvs_ent_close(ent, ENT_SYNC); } } else { - if ((p = strrchr(cf->file_rpath, ',')) != NULL) - *p = '\0'; - if (co_flags & CO_MERGE) { cvs_merge_file(cf, 1); tosend = cf->file_path; @@ -359,8 +356,5 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, int co_flags) cvs_worklist_unlink); } } - - if (p != NULL) - *p = ','; } } diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c index 7dd2305b21f..1cda377d241 100644 --- a/usr.bin/cvs/client.c +++ b/usr.bin/cvs/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.68 2007/06/29 12:42:05 xsa Exp $ */ +/* $OpenBSD: client.c,v 1.69 2007/07/03 13:22:42 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -167,7 +167,7 @@ client_check_directory(char *data) STRIP_SLASH(data); - cvs_mkpath(data); + cvs_mkpath(data, NULL); if ((base = basename(data)) == NULL) fatal("client_check_directory: overflow"); @@ -634,6 +634,7 @@ cvs_client_updated(char *data) char repo[MAXPATHLEN], entry[CVS_ENT_MAXLINELEN]; char timebuf[CVS_TIME_BUFSZ], revbuf[CVS_REV_BUFSZ]; char *en, *mode, *len, *fpath, *rpath, *wdir; + char sticky[CVS_ENT_MAXLINELEN]; if (data == NULL) fatal("Missing argument for Updated"); @@ -674,9 +675,15 @@ cvs_client_updated(char *data) e = cvs_ent_parse(en); xfree(en); + + sticky[0] = '\0'; + if (e->ce_tag != NULL) + (void)xsnprintf(sticky, sizeof(sticky), "T%s", e->ce_tag); + rcsnum_tostr(e->ce_rev, revbuf, sizeof(revbuf)); - (void)xsnprintf(entry, CVS_ENT_MAXLINELEN, "/%s/%s/%s/%s/", e->ce_name, - revbuf, timebuf, e->ce_opts ? e->ce_opts : ""); + (void)xsnprintf(entry, CVS_ENT_MAXLINELEN, "/%s/%s/%s/%s/%s", + e->ce_name, revbuf, timebuf, + e->ce_opts ? e->ce_opts : "", sticky); cvs_ent_free(e); ent = cvs_ent_open(wdir); @@ -887,6 +894,8 @@ cvs_client_set_sticky(char *data) xfree(dir); tag = cvs_remote_input(); + client_check_directory(data); + (void)xsnprintf(tagpath, MAXPATHLEN, "%s/%s", data, CVS_PATH_TAG); if ((fp = fopen(tagpath, "w+")) == NULL) { @@ -916,8 +925,10 @@ cvs_client_clear_sticky(char *data) dir = cvs_remote_input(); xfree(dir); + client_check_directory(data); + (void)xsnprintf(tagpath, MAXPATHLEN, "%s/%s", data, CVS_PATH_TAG); - (void)cvs_unlink(tagpath); + (void)unlink(tagpath); } diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h index 1e75de38078..b64b506d8c2 100644 --- a/usr.bin/cvs/cvs.h +++ b/usr.bin/cvs/cvs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.h,v 1.140 2007/06/28 21:38:09 xsa Exp $ */ +/* $OpenBSD: cvs.h,v 1.141 2007/07/03 13:22:42 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -298,6 +298,7 @@ extern char *cvs_rsh; extern char *cvs_tmpdir; extern char *import_repository; extern char *cvs_server_path; +extern char *cvs_specified_tag; extern int cvs_umask; extern int verbosity; @@ -311,6 +312,7 @@ extern int cvs_readonly; extern int cvs_readonlyfs; extern int cvs_error; extern int cvs_server_active; +extern int reset_stickies; extern struct cvs_cmd *cvs_cdt[]; diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c index 41309f2020e..d13a3258c15 100644 --- a/usr.bin/cvs/entries.c +++ b/usr.bin/cvs/entries.c @@ -1,4 +1,4 @@ -/* $OpenBSD: entries.c,v 1.78 2007/06/02 09:00:19 niallo Exp $ */ +/* $OpenBSD: entries.c,v 1.79 2007/07/03 13:22:42 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -442,6 +442,7 @@ cvs_write_tagfile(const char *dir, char *tag, char *date, int nb) } return; } + if (tag != NULL) { if (nb != 0) (void)fprintf(fp, "N%s\n", tag); diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index 6e50c39cb63..8bc2e82267c 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.193 2007/06/28 21:38:09 xsa Exp $ */ +/* $OpenBSD: file.c,v 1.194 2007/07/03 13:22:42 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -338,7 +338,7 @@ cvs_file_walkdir(struct cvs_file *cf, struct cvs_recursion *cr) struct cvs_ent_line *line; struct cvs_flisthead fl, dl; CVSENTRIES *entlist; - char *p, *buf, *ebuf, *cp, repo[MAXPATHLEN], fpath[MAXPATHLEN]; + char *buf, *ebuf, *cp, repo[MAXPATHLEN], fpath[MAXPATHLEN]; cvs_log(LP_TRACE, "cvs_file_walkdir(%s)", cf->file_path); @@ -467,17 +467,6 @@ cvs_file_walkdir(struct cvs_file *cf, struct cvs_recursion *cr) cvs_file_get(fpath, &dl); break; case CVS_FILE: - if ((p = strrchr(cf->file_path, '/')) && - !strcmp(p + 1, CVS_PATH_ATTIC)) { - - *p = '\0'; - len = xsnprintf(fpath, MAXPATHLEN, - "%s/%s", cf->file_path, dp->d_name); - *p = '/'; - } - if (fpath[len - 2] == ',' && - fpath[len - 1] == 'v') - fpath[len - 2] = '\0'; cvs_file_get(fpath, &fl); break; default: @@ -563,7 +552,7 @@ cvs_file_classify(struct cvs_file *cf, const char *tag) CVSENTRIES *entlist = NULL; const char *state; char repo[MAXPATHLEN], rcsfile[MAXPATHLEN]; - char r1[CVS_REV_BUFSZ], r2[CVS_REV_BUFSZ], *tfname, *tpath, *p; + char r1[CVS_REV_BUFSZ], r2[CVS_REV_BUFSZ]; cvs_log(LP_TRACE, "cvs_file_classify(%s)", cf->file_path); @@ -572,7 +561,6 @@ cvs_file_classify(struct cvs_file *cf, const char *tag) return; } - cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN); (void)xsnprintf(rcsfile, MAXPATHLEN, "%s/%s", repo, cf->file_name); @@ -584,22 +572,6 @@ cvs_file_classify(struct cvs_file *cf, const char *tag) } cf->file_rpath = xstrdup(rcsfile); - /* XXX: likely wrong place for this shit */ - /* is this file in the Attic? */ - if (cf->file_type == CVS_FILE - && strstr(cf->file_rpath, CVS_PATH_ATTIC) != NULL) { - cf->in_attic = 1; - /* chop the 'Attic' out of cf->file_path */ - if ((tfname = basename(cf->file_path)) == NULL) - fatal("cvs_file_classify: basename failure"); - if ((tpath = dirname(cf->file_path)) == NULL) - fatal("cvs_file_classify: dirname failure"); - if ((p = strstr(tpath, CVS_PATH_ATTIC)) == NULL) - fatal("cvs_file_classify: strstr failure"); - strlcpy(cf->file_path, tpath, p - tpath + 1); - strlcat(cf->file_path, tfname, MAXPATHLEN); - } - entlist = cvs_ent_open(cf->file_wd); cf->file_ent = cvs_ent_get(entlist, cf->file_name); @@ -638,15 +610,27 @@ cvs_file_classify(struct cvs_file *cf, const char *tag) break; } - if (strncmp(cf->file_path, CVS_JUNK, strlen(CVS_JUNK)) == 0) { - cf->file_status = FILE_UNKNOWN; - return; - } cf->repo_fd = open(cf->file_rpath, O_RDONLY); if (cf->repo_fd != -1) { cf->file_rcs = rcs_open(cf->file_rpath, cf->repo_fd, rflags); if (cf->file_rcs == NULL) fatal("cvs_file_classify: failed to parse RCS"); + } else { + (void)xsnprintf(rcsfile, MAXPATHLEN, "%s/%s/%s%s", + repo, CVS_PATH_ATTIC, cf->file_name, RCS_FILE_EXT); + + cf->repo_fd = open(rcsfile, O_RDONLY); + if (cf->repo_fd != -1) { + xfree(cf->file_rpath); + cf->file_rpath = xstrdup(rcsfile); + cf->file_rcs = rcs_open(cf->file_rpath, + cf->repo_fd, rflags); + if (cf->file_rcs == NULL) + fatal("cvs_file_classify: failed to parse RCS"); + cf->in_attic = 1; + } else { + cf->file_rcs = NULL; + } } if (tag != NULL && cf->file_rcs != NULL) { @@ -771,7 +755,8 @@ cvs_file_classify(struct cvs_file *cf, const char *tag) } } } else if (cf->file_ent->ce_status == CVS_ENT_REG) { - if (cf->file_rcs == NULL || rcsdead == 1) { + if (cf->file_rcs == NULL || rcsdead == 1 || + (reset_stickies == 1 && cf->in_attic == 1)) { if (cf->fd == -1) { cvs_log(LP_NOTICE, "warning: %s's entry exists but" diff --git a/usr.bin/cvs/history.c b/usr.bin/cvs/history.c index 085c905307d..3cb1d236033 100644 --- a/usr.bin/cvs/history.c +++ b/usr.bin/cvs/history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: history.c,v 1.31 2007/06/28 21:38:09 xsa Exp $ */ +/* $OpenBSD: history.c,v 1.32 2007/07/03 13:22:43 joris Exp $ */ /* * Copyright (c) 2007 Joris Vink <joris@openbsd.org> * @@ -87,9 +87,6 @@ cvs_history_add(int type, struct cvs_file *cf, const char *argument) /* construct repository field */ if (cvs_cmdop != CVS_OP_CHECKOUT && cvs_cmdop != CVS_OP_EXPORT) { cvs_get_repository_name(".", repo, sizeof(repo)); - - if (strlen(repo) > strlen(cwd)) - fatal("bad repository `%s'", repo); } else { strlcpy(repo, argument, sizeof(repo)); } diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 9cb8b14eee2..4973f3f31a1 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.214 2007/06/28 21:38:09 xsa Exp $ */ +/* $OpenBSD: rcs.c,v 1.215 2007/07/03 13:22:43 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -2560,6 +2560,12 @@ rcs_translate_tag(const char *revstr, RCSFILE *rfp) rdp = NULL; + if (!strcmp(revstr, RCS_HEAD_BRANCH)) { + frev = rcsnum_alloc(); + rcsnum_cpy(rfp->rf_head, frev, 0); + return (frev); + } + /* Possibly we could be passed a version number */ if ((frev = rcsnum_parse(revstr)) != NULL) return (frev); diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h index 8bd0d759441..35a8e3be8c8 100644 --- a/usr.bin/cvs/remote.h +++ b/usr.bin/cvs/remote.h @@ -1,4 +1,4 @@ -/* $OpenBSD: remote.h,v 1.23 2007/06/29 12:42:05 xsa Exp $ */ +/* $OpenBSD: remote.h,v 1.24 2007/07/03 13:22:43 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -87,6 +87,8 @@ void cvs_server_static_directory(char *); void cvs_server_sticky(char *); void cvs_server_update_patches(char *); void cvs_server_update_entry(const char *, struct cvs_file *cf); +void cvs_server_set_sticky(char *, char *); +void cvs_server_clear_sticky(char *); void cvs_server_add(char *); void cvs_server_import(char *); diff --git a/usr.bin/cvs/repository.c b/usr.bin/cvs/repository.c index 423a9ce0768..e255ff338f6 100644 --- a/usr.bin/cvs/repository.c +++ b/usr.bin/cvs/repository.c @@ -1,4 +1,4 @@ -/* $OpenBSD: repository.c,v 1.13 2007/06/01 17:47:47 niallo Exp $ */ +/* $OpenBSD: repository.c,v 1.14 2007/07/03 13:22:43 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -147,7 +147,10 @@ cvs_repository_getdir(const char *dir, const char *wdir, switch (type) { case CVS_DIR: - cvs_file_get(fpath, dl); + if (!strcmp(dp->d_name, CVS_PATH_ATTIC)) + cvs_repository_getdir(rpath, wdir, fl, dl, 0); + else + cvs_file_get(fpath, dl); break; case CVS_FILE: if ((s = strrchr(fpath, ',')) != NULL) diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c index c15e21f58fd..1b355678220 100644 --- a/usr.bin/cvs/server.c +++ b/usr.bin/cvs/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.64 2007/06/29 12:42:05 xsa Exp $ */ +/* $OpenBSD: server.c,v 1.65 2007/07/03 13:22:43 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -315,7 +315,7 @@ cvs_server_directory(char *data) else p = xstrdup(repo + 1); - cvs_mkpath(p); + cvs_mkpath(p, NULL); if ((dirn = basename(p)) == NULL) fatal("cvs_server_directory: %s", strerror(errno)); @@ -646,13 +646,44 @@ void cvs_server_update_entry(const char *resp, struct cvs_file *cf) { char *p; + char repo[MAXPATHLEN], fpath[MAXPATHLEN]; if ((p = strrchr(cf->file_rpath, ',')) != NULL) *p = '\0'; + cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN); + (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", repo, cf->file_name); + cvs_server_send_response("%s %s/", resp, cf->file_wd); - cvs_remote_output(cf->file_rpath); + cvs_remote_output(fpath); if (p != NULL) *p = ','; } + +void +cvs_server_set_sticky(char *dir, char *tag) +{ + char fpath[MAXPATHLEN], tbuf[CVS_ENT_MAXLINELEN]; + + (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", + current_cvsroot->cr_dir, dir); + + (void)xsnprintf(tbuf, MAXPATHLEN, "T%s", tag); + + cvs_server_send_response("Set-sticky %s", dir); + cvs_remote_output(fpath); + cvs_remote_output(tbuf); +} + +void +cvs_server_clear_sticky(char *dir) +{ + char fpath[MAXPATHLEN]; + + (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", + current_cvsroot->cr_dir, dir); + + cvs_server_send_response("Clear-sticky %s", dir); + cvs_remote_output(fpath); +} diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index 3d85922f566..21bc35bcddb 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.103 2007/06/28 21:38:09 xsa Exp $ */ +/* $OpenBSD: update.c,v 1.104 2007/07/03 13:22:43 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -30,7 +30,7 @@ int prune_dirs = 0; int print = 0; int build_dirs = 0; int reset_stickies = 0; -char *tag = NULL; +char *cvs_specified_tag = NULL; static void update_clear_conflict(struct cvs_file *); @@ -62,7 +62,7 @@ cvs_update(int argc, char **argv) break; case 'C': case 'D': - tag = optarg; + cvs_specified_tag = optarg; break; case 'd': build_dirs = 1; @@ -91,7 +91,7 @@ cvs_update(int argc, char **argv) case 'R': break; case 'r': - tag = optarg; + cvs_specified_tag = optarg; break; default: fatal("%s", cvs_cmd_update.cmd_synopsis); @@ -144,15 +144,15 @@ cvs_update(int argc, char **argv) void cvs_update_enterdir(struct cvs_file *cf) { - char *entry; CVSENTRIES *entlist; + char *entry, fpath[MAXPATHLEN]; cvs_log(LP_TRACE, "cvs_update_enterdir(%s)", cf->file_path); cvs_file_classify(cf, NULL); if (cf->file_status == DIR_CREATE && build_dirs == 1) { - cvs_mkpath(cf->file_path); + cvs_mkpath(cf->file_path, cvs_specified_tag); if ((cf->fd = open(cf->file_path, O_RDONLY)) == -1) fatal("cvs_update_enterdir: `%s': %s", cf->file_path, strerror(errno)); @@ -166,6 +166,17 @@ cvs_update_enterdir(struct cvs_file *cf) } else if ((cf->file_status == DIR_CREATE && build_dirs == 0) || cf->file_status == FILE_UNKNOWN) { cf->file_status = FILE_SKIP; + } else if (reset_stickies == 1) { + (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", + cf->file_path, CVS_PATH_TAG); + (void)unlink(fpath); + } else { + if (cvs_specified_tag != NULL) + cvs_write_tagfile(cf->file_path, + cvs_specified_tag, NULL, 0); + + cvs_parse_tagfile(cf->file_path, + &cvs_specified_tag, NULL, NULL); } } @@ -287,7 +298,7 @@ cvs_update_local(struct cvs_file *cf) } flags = 0; - cvs_file_classify(cf, tag); + cvs_file_classify(cf, cvs_specified_tag); if ((cf->file_status == FILE_UPTODATE || cf->file_status == FILE_MODIFIED) && cf->file_ent != NULL && @@ -297,6 +308,10 @@ cvs_update_local(struct cvs_file *cf) else cf->file_status = FILE_CHECKOUT; cf->file_rcsrev = rcs_head_get(cf->file_rcs); + + /* might be a bit overkill */ + if (cvs_server_active == 1) + cvs_server_clear_sticky(cf->file_wd); } if (print && cf->file_status != FILE_UNKNOWN) { @@ -335,7 +350,7 @@ cvs_update_local(struct cvs_file *cf) case FILE_LOST: case FILE_CHECKOUT: case FILE_PATCH: - if (tag != NULL) + if (cvs_specified_tag != NULL) flags = CO_SETSTICKY; cvs_checkout_file(cf, cf->file_rcsrev, flags); diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c index a9b837f0c7f..1a8f8eda862 100644 --- a/usr.bin/cvs/util.c +++ b/usr.bin/cvs/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.111 2007/05/29 00:19:10 ray Exp $ */ +/* $OpenBSD: util.c,v 1.112 2007/07/03 13:22:43 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org> @@ -36,6 +36,7 @@ #include <unistd.h> #include "cvs.h" +#include "remote.h" /* letter -> mode type map */ static const int cvs_modetypes[26] = { @@ -581,7 +582,7 @@ cvs_mkadmin(const char *path, const char *root, const char *repo, } void -cvs_mkpath(const char *path) +cvs_mkpath(const char *path, char *tag) { FILE *fp; size_t len; @@ -636,7 +637,12 @@ cvs_mkpath(const char *path) fatal("cvs_mkpath: %s: %s", rpath, strerror(errno)); cvs_mkadmin(rpath, current_cvsroot->cr_str, repo, - NULL, NULL, 0); + tag, NULL, 0); + + if (cvs_server_active == 1 && strcmp(rpath, ".")) { + if (tag != NULL) + cvs_server_set_sticky(rpath, tag); + } } xfree(dir); diff --git a/usr.bin/cvs/util.h b/usr.bin/cvs/util.h index 3584aabb9b5..be3a0d0c85c 100644 --- a/usr.bin/cvs/util.h +++ b/usr.bin/cvs/util.h @@ -1,4 +1,4 @@ -/* $OpenBSD: util.h,v 1.19 2007/05/09 21:19:28 xsa Exp $ */ +/* $OpenBSD: util.h,v 1.20 2007/07/03 13:22:43 joris Exp $ */ /* * Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org> * All rights reserved. @@ -33,7 +33,7 @@ void cvs_modetostr(mode_t, char *, size_t); void cvs_strtomode(const char *, mode_t *); void cvs_mkadmin(const char *, const char *, const char *, char *, char *, int); -void cvs_mkpath(const char *); +void cvs_mkpath(const char *, char *); int cvs_cksum(const char *, char *, size_t); int cvs_getargv(const char *, char **, int); int cvs_chdir(const char *, int); |