summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/update.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2007-07-03 13:22:44 +0000
committerJoris Vink <joris@cvs.openbsd.org>2007-07-03 13:22:44 +0000
commitbd5e0281b3317c92d15c4e781c2c3df1c90827d1 (patch)
treeb60313fa62ffbfe07b7c94dfacc59e7b1f468368 /usr.bin/cvs/update.c
parent0a517d4100b3c41e5336ee809374a2e7e0e7249e (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/cvs/update.c')
-rw-r--r--usr.bin/cvs/update.c31
1 files changed, 23 insertions, 8 deletions
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);