summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2008-02-09 17:01:44 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2008-02-09 17:01:44 +0000
commit5f9c473e450434cf7642f1ca681191738b7aec98 (patch)
tree02ae9e7c7285546c24b3db4511784e00d2dbc464
parentb98147fd25828f695f5838acee37747e2fd8cfb4 (diff)
Support for checkout -D extended:
Properly write CVS/Tag and CVS/Entries on various combinations of -r and -D. OK joris@
-rw-r--r--usr.bin/cvs/checkout.c9
-rw-r--r--usr.bin/cvs/entries.c9
-rw-r--r--usr.bin/cvs/update.c8
3 files changed, 17 insertions, 9 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index 46fe8a35280..6697a34b400 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.133 2008/02/09 12:48:23 joris Exp $ */
+/* $OpenBSD: checkout.c,v 1.134 2008/02/09 17:01:43 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -423,6 +423,7 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, char *tag, int co_flags)
time_t rcstime;
CVSENTRIES *ent;
struct timeval tv[2];
+ struct tm *datetm;
char *tosend;
char template[MAXPATHLEN], entry[CVS_ENT_MAXLINELEN];
char kbuf[8], sticky[CVS_REV_BUFSZ], rev[CVS_REV_BUFSZ];
@@ -495,7 +496,11 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, char *tag, int co_flags)
if (co_flags & CO_SETSTICKY)
if (tag != NULL)
(void)xsnprintf(sticky, sizeof(sticky), "T%s", tag);
- else
+ else if (cvs_specified_date != 0) {
+ datetm = gmtime(&cvs_specified_date);
+ strftime(sticky, sizeof(sticky), "D%Y.%m.%d.%H.%M.%S",
+ datetm);
+ } else
(void)xsnprintf(sticky, sizeof(sticky), "T%s", rev);
else if (!reset_tag && cf->file_ent != NULL &&
cf->file_ent->ce_tag != NULL)
diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c
index 8970996569e..1b6153a9d63 100644
--- a/usr.bin/cvs/entries.c
+++ b/usr.bin/cvs/entries.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: entries.c,v 1.88 2008/02/04 18:23:58 tobias Exp $ */
+/* $OpenBSD: entries.c,v 1.89 2008/02/09 17:01:43 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -427,6 +427,7 @@ cvs_write_tagfile(const char *dir, char *tag, char *date)
RCSNUM *rev;
char tagpath[MAXPATHLEN];
char sticky[CVS_REV_BUFSZ];
+ struct tm *datetm;
int i;
cvs_log(LP_TRACE, "cvs_write_tagfile(%s, %s, %s)", dir,
@@ -439,7 +440,7 @@ cvs_write_tagfile(const char *dir, char *tag, char *date)
if (i < 0 || i >= MAXPATHLEN)
return;
- if ((tag != NULL) || (date != NULL)) {
+ if (tag != NULL || cvs_specified_date != 0) {
if ((fp = fopen(tagpath, "w+")) == NULL) {
if (errno != ENOENT) {
cvs_log(LP_NOTICE, "failed to open `%s' : %s",
@@ -458,7 +459,9 @@ cvs_write_tagfile(const char *dir, char *tag, char *date)
"T%s", tag);
}
} else {
- (void)xsnprintf(sticky, sizeof(sticky), "D%s", date);
+ datetm = gmtime(&cvs_specified_date);
+ strftime(sticky, sizeof(sticky), "D%Y.%m.%d.%H.%M.%S",
+ datetm);
}
if (cvs_server_active == 1)
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index de422f54034..19559cdcead 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.126 2008/02/09 13:09:33 joris Exp $ */
+/* $OpenBSD: update.c,v 1.127 2008/02/09 17:01:43 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -405,7 +405,7 @@ cvs_update_local(struct cvs_file *cf)
case FILE_LOST:
case FILE_CHECKOUT:
case FILE_PATCH:
- if ((tag != NULL && !reset_tag) ||
+ if ((tag != NULL && !reset_tag) || cvs_specified_date != 0 ||
(((cf->file_ent != NULL) && cf->file_ent->ce_tag != NULL) &&
!reset_tag))
flags = CO_SETSTICKY;
@@ -441,8 +441,8 @@ cvs_update_local(struct cvs_file *cf)
if (cvs_cmdop != CVS_OP_UPDATE)
break;
- if (tag != NULL && cf->file_rcs->rf_dead != 1 &&
- (cf->file_flags & FILE_HAS_TAG))
+ if ((tag != NULL && cf->file_rcs->rf_dead != 1 &&
+ (cf->file_flags & FILE_HAS_TAG)) || cvs_specified_date != 0)
cvs_checkout_file(cf, cf->file_rcsrev,
tag, CO_SETSTICKY);
break;