summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/cvs/annotate.c7
-rw-r--r--usr.bin/cvs/checkout.c15
-rw-r--r--usr.bin/cvs/cvs.h3
-rw-r--r--usr.bin/cvs/entries.c15
-rw-r--r--usr.bin/cvs/file.c5
-rw-r--r--usr.bin/cvs/rcs.c14
-rw-r--r--usr.bin/cvs/update.c13
7 files changed, 48 insertions, 24 deletions
diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c
index 64ba622da69..2aaf612faf5 100644
--- a/usr.bin/cvs/annotate.c
+++ b/usr.bin/cvs/annotate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: annotate.c,v 1.58 2008/06/09 16:34:22 tobias Exp $ */
+/* $OpenBSD: annotate.c,v 1.59 2008/06/14 03:58:29 tobias Exp $ */
/*
* Copyright (c) 2007 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -208,8 +208,9 @@ cvs_annotate_local(struct cvs_file *cf)
}
rcsnum_free(rev);
} else {
- rcs_rev_getlines(cf->file_rcs, (cvs_specified_date != -1) ?
- cf->file_rcsrev : cf->file_rcs->rf_head, &alines);
+ rcs_rev_getlines(cf->file_rcs, (cvs_specified_date != -1 ||
+ cvs_directory_date != -1) ? cf->file_rcsrev :
+ cf->file_rcs->rf_head, &alines);
}
/* Stick at weird GNU cvs, ignore error. */
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index d231a0059d6..0dcdd75c383 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.153 2008/06/14 03:19:15 joris Exp $ */
+/* $OpenBSD: checkout.c,v 1.154 2008/06/14 03:58:29 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -51,6 +51,7 @@ static int nflag = 0;
char *checkout_target_dir = NULL;
time_t cvs_specified_date = -1;
+time_t cvs_directory_date = -1;
int disable_fast_checkout = 0;
struct cvs_cmd cvs_cmd_checkout = {
@@ -94,6 +95,7 @@ cvs_checkout(int argc, char **argv)
case 'D':
dateflag = optarg;
cvs_specified_date = cvs_date_parse(dateflag);
+ reset_tag = 0;
break;
case 'd':
if (dflag != NULL)
@@ -530,17 +532,22 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, char *tag, int co_flags)
strlcpy(timebuf, tbuf, sizeof(timebuf));
}
- if (co_flags & CO_SETSTICKY)
+ if (reset_tag) {
+ sticky[0] = '\0';
+ } else if (co_flags & CO_SETSTICKY)
if (tag != NULL)
(void)xsnprintf(sticky, sizeof(sticky), "T%s", tag);
else if (cvs_specified_date != -1) {
gmtime_r(&cvs_specified_date, &datetm);
(void)strftime(sticky, sizeof(sticky),
"D"CVS_DATE_FMT, &datetm);
+ } else if (cvs_directory_date != -1) {
+ gmtime_r(&cvs_directory_date, &datetm);
+ (void)strftime(sticky, sizeof(sticky),
+ "D"CVS_DATE_FMT, &datetm);
} else
(void)xsnprintf(sticky, sizeof(sticky), "T%s", rev);
- else if (!reset_tag && cf->file_ent != NULL &&
- cf->file_ent->ce_tag != NULL)
+ else if (cf->file_ent != NULL && cf->file_ent->ce_tag != NULL)
(void)xsnprintf(sticky, sizeof(sticky), "T%s",
cf->file_ent->ce_tag);
else
diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h
index bce08ce6682..615b489a2cd 100644
--- a/usr.bin/cvs/cvs.h
+++ b/usr.bin/cvs/cvs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.h,v 1.167 2008/06/10 01:00:34 joris Exp $ */
+/* $OpenBSD: cvs.h,v 1.168 2008/06/14 03:58:29 tobias Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -312,6 +312,7 @@ extern char *cvs_tmpdir;
extern char *import_repository;
extern char *cvs_server_path;
extern time_t cvs_specified_date;
+extern time_t cvs_directory_date;
extern char *cvs_specified_tag;
extern char *cvs_directory_tag;
diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c
index e9f1f579f86..b17327ce6b3 100644
--- a/usr.bin/cvs/entries.c
+++ b/usr.bin/cvs/entries.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: entries.c,v 1.98 2008/06/14 03:19:15 joris Exp $ */
+/* $OpenBSD: entries.c,v 1.99 2008/06/14 03:58:29 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -417,6 +417,8 @@ cvs_parse_tagfile(char *dir, char **tagp, char **datep, int *nbp)
struct tm datetm;
char linebuf[128], tagpath[MAXPATHLEN];
+ cvs_directory_date = -1;
+
if (tagp != NULL)
*tagp = NULL;
@@ -464,8 +466,7 @@ cvs_parse_tagfile(char *dir, char **tagp, char **datep, int *nbp)
datetm.tm_year -= 1900;
datetm.tm_mon -= 1;
- if (cvs_specified_date == -1)
- cvs_specified_date = timegm(&datetm);
+ cvs_directory_date = timegm(&datetm);
if (datep != NULL)
*datep = xstrdup(linebuf + 1);
@@ -506,7 +507,8 @@ cvs_write_tagfile(const char *dir, char *tag, char *date)
if (i < 0 || i >= MAXPATHLEN)
return;
- if (tag != NULL || cvs_specified_date != -1) {
+ if (tag != NULL || cvs_specified_date != -1 ||
+ cvs_directory_date == -1) {
if ((fp = fopen(tagpath, "w+")) == NULL) {
if (errno != ENOENT) {
cvs_log(LP_NOTICE, "failed to open `%s' : %s",
@@ -525,7 +527,10 @@ cvs_write_tagfile(const char *dir, char *tag, char *date)
"T%s", tag);
}
} else {
- gmtime_r(&cvs_specified_date, &datetm);
+ if (cvs_specified_date != -1)
+ gmtime_r(&cvs_specified_date, &datetm);
+ else
+ gmtime_r(&cvs_directory_date, &datetm);
(void)strftime(sticky, sizeof(sticky),
"D"CVS_DATE_FMT, &datetm);
}
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 07f75ed6100..f8f2930bbf1 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.247 2008/06/14 03:19:15 joris Exp $ */
+/* $OpenBSD: file.c,v 1.248 2008/06/14 03:58:29 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -784,7 +784,8 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
if (!strcmp(state, RCS_STATE_DEAD))
rcsdead = 1;
- if (cvs_specified_date == -1 && tag == NULL && cf->in_attic &&
+ if (cvs_specified_date == -1 && cvs_directory_date == -1 &&
+ tag == NULL && cf->in_attic &&
!RCSNUM_ISBRANCHREV(cf->file_rcsrev))
rcsdead = 1;
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index f87a072b439..adad03473b2 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.273 2008/06/14 03:19:15 joris Exp $ */
+/* $OpenBSD: rcs.c,v 1.274 2008/06/14 03:58:29 tobias Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -3501,6 +3501,7 @@ rcs_translate_tag(const char *revstr, RCSFILE *rfp)
char branch[CVS_REV_BUFSZ];
RCSNUM *brev, *frev, *rev, *rrev;
struct rcs_delta *rdp, *trdp;
+ time_t cdate;
brev = frev = rrev = NULL;
@@ -3541,7 +3542,12 @@ rcs_translate_tag(const char *revstr, RCSFILE *rfp)
rcsnum_free(rrev);
}
- if (cvs_specified_date == -1) {
+ if (cvs_specified_date != -1)
+ cdate = cvs_specified_date;
+ else
+ cdate = cvs_directory_date;
+
+ if (cdate == -1) {
/* XXX */
if (rev->rn_len < 4 || !follow) {
return (rev);
@@ -3576,7 +3582,7 @@ rcs_translate_tag(const char *revstr, RCSFILE *rfp)
deltatime = timelocal(&(rdp->rd_date));
if (RCSNUM_ISBRANCHREV(rdp->rd_num)) {
- if (deltatime > cvs_specified_date) {
+ if (deltatime > cdate) {
trdp = TAILQ_PREV(rdp, rcs_dlist, rd_list);
if (trdp == NULL)
trdp = rdp;
@@ -3595,7 +3601,7 @@ rcs_translate_tag(const char *revstr, RCSFILE *rfp)
return (rev);
}
} else {
- if (deltatime < cvs_specified_date) {
+ if (deltatime < cdate) {
rev = rcsnum_alloc();
rcsnum_cpy(rdp->rd_num, rev, 0);
return (rev);
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index 29c83528f43..ac7792d48d6 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.152 2008/06/14 03:19:15 joris Exp $ */
+/* $OpenBSD: update.c,v 1.153 2008/06/14 03:58:29 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -79,6 +79,7 @@ cvs_update(int argc, char **argv)
case 'D':
dateflag = optarg;
cvs_specified_date = cvs_date_parse(dateflag);
+ reset_tag = 0;
break;
case 'd':
build_dirs = 1;
@@ -415,9 +416,9 @@ cvs_update_local(struct cvs_file *cf)
case FILE_LOST:
case FILE_CHECKOUT:
case FILE_PATCH:
- if ((tag != NULL && !reset_tag) || cvs_specified_date != -1 ||
- (((cf->file_ent != NULL) && cf->file_ent->ce_tag != NULL) &&
- !reset_tag))
+ if (!reset_tag && (tag != NULL || cvs_specified_date != -1 ||
+ cvs_directory_date != -1 || (cf->file_ent != NULL &&
+ cf->file_ent->ce_tag != NULL)))
flags = CO_SETSTICKY;
cvs_checkout_file(cf, cf->file_rcsrev, tag, flags);
@@ -455,7 +456,9 @@ cvs_update_local(struct cvs_file *cf)
if (cf->file_rcsrev == NULL)
break;
- if (tag == NULL && cvs_specified_date == -1)
+ if (tag == NULL && cvs_specified_date == -1 &&
+ cvs_directory_date == -1 && !reset_tag &&
+ !reset_option)
break;
if (cf->file_rcs->rf_dead != 1 &&