summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2006-12-14 15:13:18 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2006-12-14 15:13:18 +0000
commit7574241e653323a026136f0b4c6bba9c457e11f4 (patch)
tree2cde3f4c2c87a6b6833fff77814076fae9b2c782
parent721e2e6e9c80b1dd2e9bedc2b2f8eb273ccfb684 (diff)
add support for the "Sticky" request; client-side only for now.
-rw-r--r--usr.bin/cvs/client.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index 3361db965ab..a72ce40c1ef 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.28 2006/11/27 16:19:59 xsa Exp $ */
+/* $OpenBSD: client.c,v 1.29 2006/12/14 15:13:17 xsa Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -386,7 +386,10 @@ cvs_client_get_responses(void)
void
cvs_client_senddir(const char *dir)
{
- char *repo;
+ int nb;
+ char *d, *date, *repo, *tag;
+
+ d = NULL;
if (lastdir != NULL && !strcmp(dir, lastdir))
return;
@@ -398,6 +401,36 @@ cvs_client_senddir(const char *dir)
cvs_remote_output(repo);
xfree(repo);
+ d = xstrdup(dir);
+ cvs_parse_tagfile(d, &tag, &date, &nb);
+
+ if (tag != NULL || date != NULL) {
+ char buf[128];
+
+ if (tag != NULL && nb != NULL) {
+ if (strlcpy(buf, "N", sizeof(buf)) >= sizeof(buf))
+ fatal("cvs_client_senddir: truncation");
+ } else if (tag != NULL) {
+ if (strlcpy(buf, "T", sizeof(buf)) >= sizeof(buf))
+ fatal("cvs_client_senddir: truncation");
+ } else {
+ if (strlcpy(buf, "D", sizeof(buf)) >= sizeof(buf))
+ fatal("cvs_client_senddir: truncation");
+ }
+
+ if (strlcat(buf, tag ? tag : date, sizeof(buf)) >= sizeof(buf))
+ fatal("cvs_client_senddir: truncation");
+
+ cvs_client_send_request("Sticky %s", buf);
+
+ if (tag != NULL)
+ xfree(tag);
+ if (date != NULL)
+ xfree(date);
+ }
+ if (d != NULL)
+ xfree(d);
+
if (lastdir != NULL)
xfree(lastdir);
lastdir = xstrdup(dir);