Update to 0.25.0. It supports commitid.

Obtained from:	OpenBSD
This commit is contained in:
Hiroki Sato 2014-07-21 21:07:16 +00:00
parent 0050cd6e0c
commit b851d6ed3c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=362490
9 changed files with 313 additions and 3 deletions

View File

@ -1,8 +1,8 @@
# $FreeBSD$
PORTNAME= cvsync
PORTVERSION= 0.24.19
PORTREVISION= 2
PORTVERSION= 0.25.0
DISTVERSION= 0.24.19
CATEGORIES= net ipv6
MASTER_SITES= ftp://ftp.cvsync.org/pub/cvsync/ \
ftp://ftp.allbsd.org/pub/cvsync/
@ -10,7 +10,7 @@ MASTER_SITES= ftp://ftp.cvsync.org/pub/cvsync/ \
MAINTAINER= hrs@FreeBSD.org
COMMENT= Portable CVS repository synchronization utility
LICENSE= BSD
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/doc/COPYRIGHT
USES= gmake

View File

@ -0,0 +1,86 @@
$OpenBSD: patch-common_filecmp_rcs_c,v 1.1 2014/06/25 17:54:07 naddy Exp $
--- common/filecmp_rcs.c.orig Mon Jul 18 16:32:56 2005
+++ common/filecmp_rcs.c Wed Jun 25 16:00:27 2014
@@ -1808,7 +1808,13 @@ filecmp_rcs_delta_add(struct filecmp_args *fca, struct
return (false);
len = rev->num.n_len + rev->date.rd_num.n_len + rev->author.i_len;
- len += rev->state.i_len + rev->next.n_len + hashops->length + 11;
+ len += rev->state.i_len + rev->next.n_len;
+
+ if (fca->fca_proto >= CVSYNC_PROTO(0, 25))
+ len += rev->commitid.i_len + 1;
+
+ len += hashops->length + 11; /* XXX magic? */
+
for (i = 0 ; i < branches->rb_count ; i++)
len += branches->rb_num[i].n_len + 1;
if (len > fca->fca_cmdmax) {
@@ -1895,6 +1901,21 @@ filecmp_rcs_delta_add(struct filecmp_args *fca, struct
rev->next.n_len);
}
+ /* commitid */
+ if (fca->fca_proto >= CVSYNC_PROTO(0, 25)) {
+ cmd[0] = rev->commitid.i_len;
+ if (!mux_send(fca->fca_mux, MUX_UPDATER, cmd, 1))
+ return (false);
+ if (rev->commitid.i_len > 0) {
+ if (!mux_send(fca->fca_mux, MUX_UPDATER, rev->commitid.i_id,
+ rev->commitid.i_len)) {
+ return (false);
+ }
+ (*hashops->update)(fca->fca_hash_ctx, rev->commitid.i_id,
+ rev->commitid.i_len);
+ }
+ }
+
(*hashops->final)(fca->fca_hash_ctx, cmd);
if (!mux_send(fca->fca_mux, MUX_UPDATER, cmd, hashops->length))
return (false);
@@ -1958,13 +1979,24 @@ filecmp_rcs_delta_update(struct filecmp_args *fca, str
rev->next.n_len);
}
+ /* commitid */
+ if (rev->commitid.i_len > 0 && fca->fca_proto >= CVSYNC_PROTO(0, 25))
+ (*hashops->update)(fca->fca_hash_ctx, rev->commitid.i_id,
+ rev->commitid.i_len);
+
(*hashops->final)(fca->fca_hash_ctx, fca->fca_hash);
if (memcmp(hash, fca->fca_hash, hashops->length) == 0)
return (true);
len = rev->num.n_len + rev->date.rd_num.n_len + rev->author.i_len;
- len += rev->state.i_len + rev->next.n_len + hashops->length + 11;
+ len += rev->state.i_len + rev->next.n_len;
+
+ if (fca->fca_proto >= CVSYNC_PROTO(0, 25))
+ len += rev->commitid.i_len + 1;
+
+ len += hashops->length + 11; /* XXX magic? */
+
for (i = 0 ; i < branches->rb_count ; i++)
len += branches->rb_num[i].n_len + 1;
if (len > fca->fca_cmdmax)
@@ -2037,6 +2069,19 @@ filecmp_rcs_delta_update(struct filecmp_args *fca, str
if (!mux_send(fca->fca_mux, MUX_UPDATER, rev->next.n_str,
rev->next.n_len)) {
return (false);
+ }
+ }
+
+ /* commitid */
+ if (fca->fca_proto >= CVSYNC_PROTO(0, 25)) {
+ cmd[0] = rev->commitid.i_len;
+ if (!mux_send(fca->fca_mux, MUX_UPDATER, cmd, 1))
+ return (false);
+ if (rev->commitid.i_len > 0) {
+ if (!mux_send(fca->fca_mux, MUX_UPDATER, rev->commitid.i_id,
+ rev->commitid.i_len)) {
+ return (false);
+ }
}
}

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-common_filescan_rcs_c,v 1.2 2014/06/25 17:54:07 naddy Exp $
--- common/filescan_rcs.c.orig Mon Jul 18 16:32:57 2005
+++ common/filescan_rcs.c Wed Jun 25 16:01:04 2014
@@ -931,6 +931,13 @@ filescan_rcs_update_rcs_delta(struct filescan_args *fs
rev->next.n_len);
}
+ /* commitid */
+ if (fsa->fsa_proto >= CVSYNC_PROTO(0, 25)) {
+ if (rev->commitid.i_len > 0)
+ (*hashops->update)(fsa->fsa_hash_ctx, rev->commitid.i_id,
+ rev->commitid.i_len);
+ }
+
(*hashops->final)(fsa->fsa_hash_ctx, cmd);
if (!mux_send(fsa->fsa_mux, MUX_FILECMP, cmd, hashops->length))

View File

@ -0,0 +1,91 @@
$OpenBSD: patch-common_rcslib_c,v 1.2 2014/06/25 17:54:07 naddy Exp $
--- common/rcslib.c.orig Mon Jul 18 16:34:30 2005
+++ common/rcslib.c Wed Jun 25 00:48:47 2014
@@ -64,6 +64,7 @@ static const struct rcs_keyword rcs_keywords[] = {
{ "strict", 6 },
{ "symbols", 7 },
{ "text", 4 },
+ { "commitid", 8 },
{ NULL, 0 }
};
@@ -83,7 +84,8 @@ enum {
RCS_STATE,
RCS_STRICT,
RCS_SYMBOLS,
- RCS_TEXT
+ RCS_TEXT,
+ RCS_COMMITID
};
#define RCS_SKIP(p, e) \
@@ -579,6 +581,40 @@ rcslib_parse_delta(struct rcslib_file *rcs, char *sp,
return (NULL);
}
+ /* commitid id; */
+ rcskey = &rcs_keywords[RCS_COMMITID];
+ if ((sp + rcskey->namelen > bp) ||
+ (memcmp(sp, rcskey->name, rcskey->namelen) != 0)) {
+ rev->commitid.i_id = NULL;
+ rev->commitid.i_len = 0;
+ } else {
+ sp += rcskey->namelen;
+
+ p = sp;
+ RCS_SKIP_NORET(sp, bp)
+ if ((sp > bp) || (sp == p)) {
+ free(delta->rd_rev);
+ return (NULL);
+ }
+
+ if ((sp = rcslib_parse_id(sp, bp, &rev->commitid)) == NULL) {
+ free(delta->rd_rev);
+ return (NULL);
+ }
+
+ RCS_SKIP_NORET(sp, bp)
+ if ((sp > bp) || (*sp++ != ';')) {
+ free(delta->rd_rev);
+ return (NULL);
+ }
+
+ RCS_SKIP_NORET(sp, bp)
+ if (sp > bp) {
+ free(delta->rd_rev);
+ return (NULL);
+ }
+ }
+
/* { newphrase }* */
p = sp;
if ((sp = rcslib_parse_newphrase(sp, bp)) == NULL) {
@@ -1522,10 +1558,24 @@ rcslib_write_delta(int fd, const struct rcslib_revisio
iov[0].iov_len = 7;
iov[1].iov_base = rev->next.n_str;
iov[1].iov_len = rev->next.n_len;
- iov[2].iov_base = ";\n\n";
- iov[2].iov_len = 3;
- len = iov[0].iov_len + iov[1].iov_len + iov[2].iov_len;
- if ((wn = writev(fd, iov, 3)) == -1)
+ iov[2].iov_base = ";\n";
+ iov[2].iov_len = 2;
+ if (rev->commitid.i_len > 0) {
+ iov[3].iov_base ="commitid\t";
+ iov[3].iov_len = 9;
+ iov[4].iov_base = rev->commitid.i_id;
+ iov[4].iov_len = rev->commitid.i_len;
+ iov[5].iov_base = ";\n\n";
+ iov[5].iov_len = 3;
+ } else {
+ iov[3].iov_base = "\n";
+ iov[3].iov_len = 1;
+ iov[4].iov_base = iov[5].iov_base = NULL;
+ iov[4].iov_len = iov[5].iov_len = 0;
+ }
+ len = iov[0].iov_len + iov[1].iov_len + iov[2].iov_len +
+ iov[3].iov_len + iov[4].iov_len + iov[5].iov_len;
+ if ((wn = writev(fd, iov, 6)) == -1)
return (false);
if ((size_t)wn != len)
return (false);

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-common_rcslib_h,v 1.2 2014/06/25 17:54:07 naddy Exp $
--- common/rcslib.h.orig Mon Jan 24 08:44:56 2005
+++ common/rcslib.h Wed Jun 25 00:48:47 2014
@@ -102,6 +102,7 @@ struct rcslib_revision {
struct rcsnum next;
struct rcsstr log;
struct rcsstr text;
+ struct rcsid commitid;
/* internal use */
struct rcslib_revision *rv_next;

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-common_refuse_c,v 1.2 2014/06/25 17:54:07 naddy Exp $
--- common/refuse.c.orig Mon Jul 18 16:32:58 2005
+++ common/refuse.c Wed Jun 25 00:48:47 2014
@@ -246,7 +246,7 @@ refuse_access(struct refuse_args *ra, struct cvsync_at
continue;
namelen = strlen(pat);
ep = pat + namelen;
- while (ep >= pat) {
+ while (ep > pat) {
if (*--ep != '/')
continue;

View File

@ -0,0 +1,65 @@
$OpenBSD: patch-common_updater_rcs_c,v 1.2 2014/06/26 20:06:50 naddy Exp $
--- common/updater_rcs.c.orig Mon Jul 18 16:32:59 2005
+++ common/updater_rcs.c Thu Jun 26 19:28:00 2014
@@ -59,6 +59,7 @@
#include "logmsg.h"
#include "mux.h"
#include "rcslib.h"
+#include "version.h"
#include "updater.h"
@@ -1930,18 +1931,50 @@ updater_rcs_write_delta(struct updater_args *uda, uint
sp += slen;
}
len -= slen + 1;
- iov[2].iov_base = ";\n\n";
- iov[2].iov_len = 3;
+ iov[2].iov_base = ";\n";
+ iov[2].iov_len = 2;
if ((wn = writev(uda->uda_fileno, iov, 3)) == -1) {
logmsg_err("%s", strerror(errno));
(*hashops->destroy)(uda->uda_hash_ctx);
return (false);
}
- if ((size_t)wn != slen + 10) {
+ if ((size_t)wn != slen + 9) {
logmsg_err("writev error");
(*hashops->destroy)(uda->uda_hash_ctx);
return (false);
+ }
+
+ /* commitid */
+ if (uda->uda_proto >= CVSYNC_PROTO(0, 25)) {
+ len--;
+ if ((slen = *sp++) != 0) {
+ iov[0].iov_base = "commitid\t";
+ iov[0].iov_len = 9;
+
+ if (len < slen) {
+ (*hashops->destroy)(uda->uda_hash_ctx);
+ return (false);
+ }
+ iov[1].iov_base = (void *)sp;
+ iov[1].iov_len = slen;
+ (*hashops->update)(uda->uda_hash_ctx, sp, slen);
+
+ sp += slen;
+ len -= slen;
+
+ iov[2].iov_base = ";\n\n";
+ iov[2].iov_len = 3;
+
+ if ((wn = writev(uda->uda_fileno, iov, 3)) == -1) {
+ (*hashops->destroy)(uda->uda_hash_ctx);
+ return (false);
+ }
+ if ((size_t)wn != slen + 12) {
+ (*hashops->destroy)(uda->uda_hash_ctx);
+ return (false);
+ }
+ }
}
if (len != hashops->length) {

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-common_version_h,v 1.1 2014/06/25 17:54:07 naddy Exp $
--- common/version.h.orig Fri Jun 3 20:03:17 2005
+++ common/version.h Wed Jun 25 00:57:44 2014
@@ -31,8 +31,8 @@
#define __VERSION_H__
#define CVSYNC_MAJOR 0
-#define CVSYNC_MINOR 24
-#define CVSYNC_PATCHLEVEL 19
+#define CVSYNC_MINOR 25
+#define CVSYNC_PATCHLEVEL 0
#define CVSYNC_PROTO_MAJOR CVSYNC_MAJOR
#define CVSYNC_PROTO_MINOR CVSYNC_MINOR

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-rcscmp_main_c,v 1.1 2014/06/25 17:54:07 naddy Exp $
--- rcscmp/main.c.orig Mon Jul 18 16:37:38 2005
+++ rcscmp/main.c Wed Jun 25 00:48:47 2014
@@ -220,6 +220,10 @@ rcscmp_hash(struct rcslib_file *rcs, const struct hash
(*hashops->update)(ctx, rev->next.n_str,
rev->next.n_len);
}
+ if (rev->commitid.i_len > 0) {
+ (*hashops->update)(ctx, rev->commitid.i_id,
+ rev->commitid.i_len);
+ }
}
if (rcs->desc.s_len > 0)