summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2007-09-22 16:01:23 +0000
committerJoris Vink <joris@cvs.openbsd.org>2007-09-22 16:01:23 +0000
commit0d83276c664f67d2670a75d00571c510830d8d10 (patch)
treee599820e2290749831ca6f4184f55756f50d74a4 /usr.bin/cvs
parenta634a04dd7e99d9335ce37798fb7b6335c3495f5 (diff)
better branching/sticky tag support, no branch commits yet though.
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/add.c4
-rw-r--r--usr.bin/cvs/admin.c4
-rw-r--r--usr.bin/cvs/annotate.c4
-rw-r--r--usr.bin/cvs/checkout.c14
-rw-r--r--usr.bin/cvs/commit.c14
-rw-r--r--usr.bin/cvs/cvs.h3
-rw-r--r--usr.bin/cvs/diff.c37
-rw-r--r--usr.bin/cvs/edit.c6
-rw-r--r--usr.bin/cvs/entries.c23
-rw-r--r--usr.bin/cvs/file.c58
-rw-r--r--usr.bin/cvs/file.h5
-rw-r--r--usr.bin/cvs/getlog.c4
-rw-r--r--usr.bin/cvs/import.c4
-rw-r--r--usr.bin/cvs/release.c6
-rw-r--r--usr.bin/cvs/remove.c4
-rw-r--r--usr.bin/cvs/repository.c6
-rw-r--r--usr.bin/cvs/server.c8
-rw-r--r--usr.bin/cvs/status.c6
-rw-r--r--usr.bin/cvs/update.c25
-rw-r--r--usr.bin/cvs/util.c10
20 files changed, 151 insertions, 94 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index 24a17c4a3c6..8c37040319b 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.80 2007/08/30 11:07:18 joris Exp $ */
+/* $OpenBSD: add.c,v 1.81 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -142,7 +142,7 @@ cvs_add_local(struct cvs_file *cf)
{
cvs_log(LP_TRACE, "cvs_add_local(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
/* dont use `cvs add *' */
if (strcmp(cf->file_name, ".") == 0 ||
diff --git a/usr.bin/cvs/admin.c b/usr.bin/cvs/admin.c
index 87f71da1193..400cf148429 100644
--- a/usr.bin/cvs/admin.c
+++ b/usr.bin/cvs/admin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: admin.c,v 1.51 2007/06/28 21:38:09 xsa Exp $ */
+/* $OpenBSD: admin.c,v 1.52 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
@@ -207,7 +207,7 @@ cvs_admin_local(struct cvs_file *cf)
cvs_log(LP_TRACE, "cvs_admin_local(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if (cf->file_type == CVS_DIR) {
if (verbosity > 1)
diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c
index b112211c596..0d49b3062c2 100644
--- a/usr.bin/cvs/annotate.c
+++ b/usr.bin/cvs/annotate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: annotate.c,v 1.38 2007/09/13 13:10:57 tobias Exp $ */
+/* $OpenBSD: annotate.c,v 1.39 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
* Copyright (c) 2007 Tobias Stoeckmann <tobias@openbsd.org>
@@ -120,7 +120,7 @@ cvs_annotate_local(struct cvs_file *cf)
cvs_log(LP_TRACE, "cvs_annotate_local(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if (cf->file_status == FILE_UNKNOWN || cf->file_status == FILE_UNLINK ||
cf->file_type != CVS_FILE)
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index a0b2f567e4e..d110c6add57 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.103 2007/09/22 15:30:29 tobias Exp $ */
+/* $OpenBSD: checkout.c,v 1.104 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -72,6 +72,8 @@ cvs_checkout(int argc, char **argv)
case 'l':
flags &= ~CR_RECURSE_DIRS;
break;
+ case 'N':
+ break;
case 'P':
prune_dirs = 1;
break;
@@ -184,6 +186,8 @@ checkout_check_repository(int argc, char **argv)
return;
}
+ cvs_directory_tag = cvs_specified_tag;
+
for (i = 0; i < argc; i++) {
(void)xsnprintf(repo, sizeof(repo), "%s/%s",
current_cvsroot->cr_dir, argv[i]);
@@ -258,7 +262,9 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, int co_flags)
exists = 0;
tosend = NULL;
- rcsnum_tostr(rnum, rev, sizeof(rev));
+
+ if (!(co_flags & CO_REMOVE))
+ rcsnum_tostr(rnum, rev, sizeof(rev));
cvs_log(LP_TRACE, "cvs_checkout_file(%s, %s, %d) -> %s",
cf->file_path, rev, co_flags,
@@ -320,9 +326,9 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, int co_flags)
}
if (co_flags & CO_SETSTICKY)
- if (cvs_specified_tag != NULL)
+ if (cvs_directory_tag != NULL)
(void)xsnprintf(stickytag, sizeof(stickytag), "T%s",
- cvs_specified_tag);
+ cvs_directory_tag);
else
(void)xsnprintf(stickytag, sizeof(stickytag), "T%s",
rev);
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index 34a51fa3590..7406c863307 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commit.c,v 1.109 2007/08/30 11:07:18 joris Exp $ */
+/* $OpenBSD: commit.c,v 1.110 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -157,7 +157,7 @@ cvs_commit_check_files(struct cvs_file *cf)
if (current_cvsroot->cr_method != CVS_METHOD_LOCAL)
cvs_remote_classify_file(cf);
else
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if (cf->file_type == CVS_DIR) {
if (verbosity > 1)
@@ -192,17 +192,17 @@ cvs_commit_check_files(struct cvs_file *cf)
if (cf->file_status == FILE_ADDED ||
cf->file_status == FILE_REMOVED ||
cf->file_status == FILE_MODIFIED)
- cvs_file_get(cf->file_path, &files_affected);
+ cvs_file_get(cf->file_path, 0, &files_affected);
switch (cf->file_status) {
case FILE_ADDED:
- cvs_file_get(cf->file_path, &files_added);
+ cvs_file_get(cf->file_path, 0, &files_added);
break;
case FILE_REMOVED:
- cvs_file_get(cf->file_path, &files_removed);
+ cvs_file_get(cf->file_path, 0, &files_removed);
break;
case FILE_MODIFIED:
- cvs_file_get(cf->file_path, &files_modified);
+ cvs_file_get(cf->file_path, 0, &files_modified);
break;
}
}
@@ -219,7 +219,7 @@ cvs_commit_local(struct cvs_file *cf)
char attic[MAXPATHLEN], repo[MAXPATHLEN], rcsfile[MAXPATHLEN];
cvs_log(LP_TRACE, "cvs_commit_local(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if (cvs_noexec == 1)
return;
diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h
index 4396b8ca0a0..b062f0d82cf 100644
--- a/usr.bin/cvs/cvs.h
+++ b/usr.bin/cvs/cvs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.h,v 1.145 2007/09/10 19:11:08 joris Exp $ */
+/* $OpenBSD: cvs.h,v 1.146 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -298,6 +298,7 @@ extern char *cvs_tmpdir;
extern char *import_repository;
extern char *cvs_server_path;
extern char *cvs_specified_tag;
+extern char *cvs_directory_tag;
extern int cvs_umask;
extern int verbosity;
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index d3650048297..b5740e73d0b 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.120 2007/06/28 21:38:09 xsa Exp $ */
+/* $OpenBSD: diff.c,v 1.121 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -173,7 +173,7 @@ cvs_diff_local(struct cvs_file *cf)
return;
}
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if (cf->file_status == FILE_LOST) {
cvs_log(LP_ERR, "cannot find file %s", cf->file_path);
@@ -196,10 +196,11 @@ cvs_diff_local(struct cvs_file *cf)
if (rev1 != NULL)
if ((diff_rev1 = rcs_translate_tag(rev1, cf->file_rcs)) == NULL)
- fatal("cvs_diff_local: could not translate tag `%s'", rev1);
+ return;
+
if (rev2 != NULL)
if ((diff_rev2 = rcs_translate_tag(rev2, cf->file_rcs)) == NULL)
- fatal("cvs_diff_local: could not translate tag `%s'", rev2);
+ return;
diff_file = cf->file_path;
cvs_printf("Index: %s\n%s\nRCS file: %s\n", cf->file_path,
@@ -236,17 +237,23 @@ cvs_diff_local(struct cvs_file *cf)
cvs_printf("Retrieving revision %s\n", rbuf);
rcs_rev_write_stmp(cf->file_rcs, diff_rev2, p2, 0);
} else if (cf->file_status != FILE_REMOVED) {
- if (fstat(cf->fd, &st) == -1)
- fatal("fstat failed %s", strerror(errno));
- if ((b1 = cvs_buf_load_fd(cf->fd, BUF_AUTOEXT)) == NULL)
- fatal("failed to load %s", cf->file_path);
-
- tv2[0].tv_sec = st.st_mtime;
- tv2[0].tv_usec = 0;
- tv2[1] = tv2[0];
-
- cvs_buf_write_stmp(b1, p2, tv2);
- cvs_buf_free(b1);
+ if (cvs_server_active == 1 &&
+ cf->file_status != FILE_MODIFIED) {
+ rcs_rev_write_stmp(cf->file_rcs,
+ cf->file_rcsrev, p2, 0);
+ } else {
+ if (fstat(cf->fd, &st) == -1)
+ fatal("fstat failed %s", strerror(errno));
+ if ((b1 = cvs_buf_load_fd(cf->fd, BUF_AUTOEXT)) == NULL)
+ fatal("failed to load %s", cf->file_path);
+
+ tv2[0].tv_sec = st.st_mtime;
+ tv2[0].tv_usec = 0;
+ tv2[1] = tv2[0];
+
+ cvs_buf_write_stmp(b1, p2, tv2);
+ cvs_buf_free(b1);
+ }
}
cvs_printf("%s", diffargs);
diff --git a/usr.bin/cvs/edit.c b/usr.bin/cvs/edit.c
index d4e9d1c010c..d17e8c79d09 100644
--- a/usr.bin/cvs/edit.c
+++ b/usr.bin/cvs/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.36 2007/07/01 10:43:13 xsa Exp $ */
+/* $OpenBSD: edit.c,v 1.37 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006, 2007 Xavier Santolaria <xsa@openbsd.org>
*
@@ -264,7 +264,7 @@ cvs_edit_local(struct cvs_file *cf)
cvs_log(LP_TRACE, "cvs_edit_local(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if ((fp = fopen(CVS_PATH_NOTIFY, "a")) == NULL)
fatal("cvs_edit_local: fopen: `%s': %s",
@@ -335,7 +335,7 @@ cvs_unedit_local(struct cvs_file *cf)
cvs_log(LP_TRACE, "cvs_unedit_local(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_file_classify);
(void)xsnprintf(bfpath, MAXPATHLEN, "%s/%s",
CVS_PATH_BASEDIR, cf->file_name);
diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c
index d1824b04e09..0f023aa1ed6 100644
--- a/usr.bin/cvs/entries.c
+++ b/usr.bin/cvs/entries.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: entries.c,v 1.81 2007/09/22 15:57:24 joris Exp $ */
+/* $OpenBSD: entries.c,v 1.82 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -418,6 +418,7 @@ cvs_write_tagfile(const char *dir, char *tag, char *date, int nb)
{
FILE *fp;
char tagpath[MAXPATHLEN];
+ char sticky[CVS_REV_BUFSZ];
int i;
if (cvs_noexec == 1)
@@ -437,13 +438,21 @@ cvs_write_tagfile(const char *dir, char *tag, char *date, int nb)
}
if (tag != NULL) {
- if (nb != 0)
- (void)fprintf(fp, "N%s\n", tag);
- else
- (void)fprintf(fp, "T%s\n", tag);
- } else
- (void)fprintf(fp, "D%s\n", date);
+ if (nb != 0) {
+ (void)xsnprintf(sticky, sizeof(sticky),
+ "N%s", tag);
+ } else {
+ (void)xsnprintf(sticky, sizeof(sticky),
+ "T%s", tag);
+ }
+ } else {
+ (void)xsnprintf(sticky, sizeof(sticky), "D%s", date);
+ }
+
+ if (cvs_server_active == 1)
+ cvs_server_set_sticky(dir, sticky);
+ (void)fprintf(fp, "%s\n", sticky);
(void)fclose(fp);
} else {
(void)cvs_unlink(tagpath);
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 3e4948728c2..9c959f8e311 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.198 2007/09/22 15:57:24 joris Exp $ */
+/* $OpenBSD: file.c,v 1.199 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -74,6 +74,7 @@ static const char *cvs_ign_std[] = {
"*$",
};
+char *cvs_directory_tag = NULL;
struct ignore_head cvs_ign_pats;
struct ignore_head dir_ign_pats;
@@ -180,14 +181,14 @@ cvs_file_run(int argc, char **argv, struct cvs_recursion *cr)
TAILQ_INIT(&fl);
for (i = 0; i < argc; i++)
- cvs_file_get(argv[i], &fl);
+ 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, struct cvs_flisthead *fl)
+cvs_file_get(const char *name, int check_dir_tag, struct cvs_flisthead *fl)
{
const char *p;
struct cvs_filelist *l;
@@ -201,6 +202,7 @@ cvs_file_get(const char *name, struct cvs_flisthead *fl)
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,6 +321,15 @@ cvs_file_walklist(struct cvs_flisthead *fl, struct cvs_recursion *cr)
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,6 +387,8 @@ cvs_file_walkdir(struct cvs_file *cf, struct cvs_recursion *cr)
return;
}
+ cvs_parse_tagfile(cf->file_path, &cvs_directory_tag, NULL, NULL);
+
/*
* check for a local .cvsignore file
*/
@@ -476,10 +489,10 @@ cvs_file_walkdir(struct cvs_file *cf, struct cvs_recursion *cr)
switch (type) {
case CVS_DIR:
if (cr->flags & CR_RECURSE_DIRS)
- cvs_file_get(fpath, &dl);
+ cvs_file_get(fpath, 0, &dl);
break;
case CVS_FILE:
- cvs_file_get(fpath, &fl);
+ cvs_file_get(fpath, 0, &fl);
break;
default:
fatal("type %d unknown, shouldn't happen",
@@ -512,9 +525,9 @@ cvs_file_walkdir(struct cvs_file *cf, struct cvs_recursion *cr)
ent->ce_type == CVS_ENT_DIR)
continue;
if (ent->ce_type == CVS_ENT_DIR)
- cvs_file_get(fpath, &dl);
+ cvs_file_get(fpath, 0, &dl);
else if (ent->ce_type == CVS_ENT_FILE)
- cvs_file_get(fpath, &fl);
+ cvs_file_get(fpath, 0, &fl);
cvs_ent_free(ent);
}
@@ -540,6 +553,12 @@ cvs_file_walkdir(struct cvs_file *cf, struct cvs_recursion *cr)
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,7 +579,7 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
size_t len;
struct stat st;
BUF *b1, *b2;
- int server_has_file;
+ int server_has_file, notag;
int rflags, ismodified, rcsdead;
CVSENTRIES *entlist = NULL;
const char *state;
@@ -647,17 +666,15 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
}
}
+ notag = 0;
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;
+ 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);
}
-
- 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);
@@ -737,8 +754,10 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
} else if (cvs_cmdop != CVS_OP_ADD) {
cf->file_status = FILE_UNKNOWN;
}
- } else {
+ } 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,7 +796,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 ||
- (reset_stickies == 1 && cf->in_attic == 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"
diff --git a/usr.bin/cvs/file.h b/usr.bin/cvs/file.h
index 498480dcfb3..f3ef3de47d5 100644
--- a/usr.bin/cvs/file.h
+++ b/usr.bin/cvs/file.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.h,v 1.44 2007/06/01 17:47:47 niallo Exp $ */
+/* $OpenBSD: file.h,v 1.45 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -72,6 +72,7 @@ struct cvs_file {
struct cvs_filelist {
char *file_path;
+ int check_dir_tag;
TAILQ_ENTRY(cvs_filelist) flist;
};
@@ -100,7 +101,7 @@ void cvs_file_run(int, char **, struct cvs_recursion *);
void cvs_file_walklist(struct cvs_flisthead *, struct cvs_recursion *);
void cvs_file_walkdir(struct cvs_file *, struct cvs_recursion *);
void cvs_file_freelist(struct cvs_flisthead *);
-struct cvs_filelist *cvs_file_get(const char *, struct cvs_flisthead *);
+struct cvs_filelist *cvs_file_get(const char *, int, struct cvs_flisthead *);
int cvs_file_chkign(const char *);
int cvs_file_cmpname(const char *, const char *);
diff --git a/usr.bin/cvs/getlog.c b/usr.bin/cvs/getlog.c
index d01176bb5b8..47deadebdce 100644
--- a/usr.bin/cvs/getlog.c
+++ b/usr.bin/cvs/getlog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getlog.c,v 1.76 2007/07/17 19:59:25 xsa Exp $ */
+/* $OpenBSD: getlog.c,v 1.77 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
@@ -175,7 +175,7 @@ cvs_log_local(struct cvs_file *cf)
cvs_log(LP_TRACE, "cvs_log_local(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_file_classify);
if (cf->file_status == FILE_UNKNOWN) {
if (verbosity > 0)
diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c
index 042332682d9..b0ee976a11a 100644
--- a/usr.bin/cvs/import.c
+++ b/usr.bin/cvs/import.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: import.c,v 1.76 2007/09/02 11:31:35 tobias Exp $ */
+/* $OpenBSD: import.c,v 1.77 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -169,7 +169,7 @@ cvs_import_local(struct cvs_file *cf)
cvs_log(LP_TRACE, "cvs_import_local(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if (cf->file_type == CVS_DIR) {
if (!strcmp(cf->file_path, "."))
diff --git a/usr.bin/cvs/release.c b/usr.bin/cvs/release.c
index 9ef8bef4357..4890da0a649 100644
--- a/usr.bin/cvs/release.c
+++ b/usr.bin/cvs/release.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: release.c,v 1.34 2007/06/26 18:02:43 xsa Exp $ */
+/* $OpenBSD: release.c,v 1.35 2007/09/22 16:01:22 joris Exp $ */
/*-
* Copyright (c) 2005-2007 Xavier Santolaria <xsa@openbsd.org>
*
@@ -107,7 +107,7 @@ cvs_release_local(struct cvs_file *cf)
cvs_log(LP_TRACE, "cvs_release_local(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if (cvs_server_active == 1) {
cvs_history_add(CVS_HISTORY_RELEASE, cf, NULL);
@@ -179,7 +179,7 @@ release_check_files(struct cvs_file *cf)
{
cvs_log(LP_TRACE, "release_check_files(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if (cf->file_status == FILE_MERGE ||
cf->file_status == FILE_ADDED ||
diff --git a/usr.bin/cvs/remove.c b/usr.bin/cvs/remove.c
index f712d7297a3..ac8c773955c 100644
--- a/usr.bin/cvs/remove.c
+++ b/usr.bin/cvs/remove.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remove.c,v 1.65 2007/06/28 21:38:09 xsa Exp $ */
+/* $OpenBSD: remove.c,v 1.66 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
*
@@ -145,7 +145,7 @@ cvs_remove_local(struct cvs_file *cf)
return;
}
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if (cf->file_status == FILE_UNKNOWN) {
if (verbosity > 1)
diff --git a/usr.bin/cvs/repository.c b/usr.bin/cvs/repository.c
index e255ff338f6..c6934cc11f1 100644
--- a/usr.bin/cvs/repository.c
+++ b/usr.bin/cvs/repository.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: repository.c,v 1.14 2007/07/03 13:22:43 joris Exp $ */
+/* $OpenBSD: repository.c,v 1.15 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -150,12 +150,12 @@ cvs_repository_getdir(const char *dir, const char *wdir,
if (!strcmp(dp->d_name, CVS_PATH_ATTIC))
cvs_repository_getdir(rpath, wdir, fl, dl, 0);
else
- cvs_file_get(fpath, dl);
+ cvs_file_get(fpath, 0, dl);
break;
case CVS_FILE:
if ((s = strrchr(fpath, ',')) != NULL)
*s = '\0';
- cvs_file_get(fpath, fl);
+ cvs_file_get(fpath, 0, fl);
break;
default:
fatal("type %d unknown, shouldn't happen", type);
diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c
index 90a13ca4372..4270243ebc9 100644
--- a/usr.bin/cvs/server.c
+++ b/usr.bin/cvs/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.71 2007/09/22 15:57:24 joris Exp $ */
+/* $OpenBSD: server.c,v 1.72 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -701,16 +701,14 @@ cvs_server_update_entry(const char *resp, struct cvs_file *cf)
void
cvs_server_set_sticky(char *dir, char *tag)
{
- char fpath[MAXPATHLEN], tbuf[CVS_ENT_MAXLINELEN];
+ char fpath[MAXPATHLEN];
(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);
+ cvs_remote_output(tag);
}
void
diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c
index c4ffdaac592..7a9efef391d 100644
--- a/usr.bin/cvs/status.c
+++ b/usr.bin/cvs/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.76 2007/07/03 12:29:52 xsa Exp $ */
+/* $OpenBSD: status.c,v 1.77 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -124,7 +124,7 @@ cvs_status_local(struct cvs_file *cf)
cvs_log(LP_TRACE, "cvs_status_local(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if (cf->file_type == CVS_DIR) {
if (verbosity > 1)
@@ -141,7 +141,7 @@ cvs_status_local(struct cvs_file *cf)
if (cf->file_status == FILE_LOST ||
cf->file_status == FILE_UNKNOWN ||
- (cf->file_rcs != NULL && cf->in_attic == 1)) {
+ (cf->file_rcs != NULL && cf->in_attic == 1 && cf->fd == -1)) {
(void)xsnprintf(buf, sizeof(buf), "no file %s\t",
cf->file_name);
} else
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index db0b10427ad..d8b5b75314c 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.109 2007/09/07 23:59:01 tobias Exp $ */
+/* $OpenBSD: update.c,v 1.110 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -121,6 +121,10 @@ cvs_update(int argc, char **argv)
if (print_stdout)
cvs_client_send_request("Argument -p");
+ if (cvs_specified_tag != NULL)
+ cvs_client_send_request("Argument -r%s",
+ cvs_specified_tag);
+
cr.enterdir = NULL;
cr.leavedir = NULL;
cr.fileproc = cvs_client_sendfile;
@@ -151,7 +155,7 @@ cvs_update_enterdir(struct cvs_file *cf)
cvs_log(LP_TRACE, "cvs_update_enterdir(%s)", cf->file_path);
- cvs_file_classify(cf, NULL);
+ cvs_file_classify(cf, cvs_directory_tag);
if (cf->file_status == DIR_CREATE && build_dirs == 1) {
cvs_mkpath(cf->file_path, cvs_specified_tag);
@@ -176,9 +180,6 @@ cvs_update_enterdir(struct cvs_file *cf)
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);
}
}
@@ -303,7 +304,7 @@ cvs_update_local(struct cvs_file *cf)
}
flags = 0;
- cvs_file_classify(cf, cvs_specified_tag);
+ cvs_file_classify(cf, cvs_directory_tag);
if ((cf->file_status == FILE_UPTODATE ||
cf->file_status == FILE_MODIFIED) && cf->file_ent != NULL &&
@@ -312,6 +313,7 @@ cvs_update_local(struct cvs_file *cf)
cf->file_status = FILE_MERGE;
else
cf->file_status = FILE_CHECKOUT;
+
cf->file_rcsrev = rcs_head_get(cf->file_rcs);
/* might be a bit overkill */
@@ -358,7 +360,9 @@ cvs_update_local(struct cvs_file *cf)
case FILE_LOST:
case FILE_CHECKOUT:
case FILE_PATCH:
- if (cvs_specified_tag != NULL)
+ if (cvs_directory_tag != NULL ||
+ (((cf->file_ent != NULL) && cf->file_ent->ce_tag != NULL) &&
+ (reset_stickies != 1)))
flags = CO_SETSTICKY;
cvs_checkout_file(cf, cf->file_rcsrev, flags);
@@ -388,6 +392,13 @@ cvs_update_local(struct cvs_file *cf)
cvs_ent_close(entlist, ENT_SYNC);
cvs_history_add(CVS_HISTORY_UPDATE_REMOVE, cf, NULL);
break;
+ case FILE_UPTODATE:
+ if (cvs_cmdop != CVS_OP_UPDATE)
+ break;
+
+ if (cvs_directory_tag != NULL && cf->file_rcs->rf_dead != 1)
+ cvs_checkout_file(cf, cf->file_rcsrev, CO_SETSTICKY);
+ break;
default:
break;
}
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index 295e8aa0e7c..316263e8957 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.118 2007/09/19 12:04:38 tobias Exp $ */
+/* $OpenBSD: util.c,v 1.119 2007/09/22 16:01:22 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
@@ -568,6 +568,7 @@ cvs_mkpath(const char *path, char *tag)
{
FILE *fp;
size_t len;
+ char sticky[CVS_REV_BUFSZ];
char *sp, *dp, *dir, rpath[MAXPATHLEN], repo[MAXPATHLEN];
dir = xstrdup(path);
@@ -622,8 +623,11 @@ cvs_mkpath(const char *path, char *tag)
tag, NULL, 0);
if (cvs_server_active == 1 && strcmp(rpath, ".")) {
- if (tag != NULL)
- cvs_server_set_sticky(rpath, tag);
+ if (tag != NULL) {
+ (void)xsnprintf(sticky, sizeof(sticky),
+ "T%s", tag);
+ cvs_server_set_sticky(rpath, sticky);
+ }
}
}