From owner-svn-src-projects@FreeBSD.ORG Sun Nov 23 14:53:21 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 586FA1065670; Sun, 23 Nov 2008 14:53:21 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DCFF8FC16; Sun, 23 Nov 2008 14:53:21 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANErLrB054761; Sun, 23 Nov 2008 14:53:21 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANErL5Q054760; Sun, 23 Nov 2008 14:53:21 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200811231453.mANErL5Q054760@svn.freebsd.org> From: Ulf Lilleengen Date: Sun, 23 Nov 2008 14:53:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185203 - projects/csup_cvsmode/contrib/csup X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 14:53:21 -0000 Author: lulf Date: Sun Nov 23 14:53:21 2008 New Revision: 185203 URL: http://svn.freebsd.org/changeset/base/185203 Log: - Add support for reading RCS info from status file to avoid having to detail a file if it is up to date. Modified: projects/csup_cvsmode/contrib/csup/lister.c Modified: projects/csup_cvsmode/contrib/csup/lister.c ============================================================================== --- projects/csup_cvsmode/contrib/csup/lister.c Sun Nov 23 14:32:40 2008 (r185202) +++ projects/csup_cvsmode/contrib/csup/lister.c Sun Nov 23 14:53:21 2008 (r185203) @@ -64,10 +64,10 @@ static int lister_dofile(struct lister * struct statusrec *); static int lister_dodead(struct lister *, struct coll *, struct statusrec *); -#if 0 static int lister_dorcsfile(struct lister *, struct coll *, - struct statusrec *, int); -#endif + struct statusrec *); +static int lister_dorcsdead(struct lister *, struct coll *, + struct statusrec *); void * lister(void *arg) @@ -150,14 +150,13 @@ lister_coll(struct lister *l, struct col struct statusrec *sr; struct fattr *fa; size_t i; - int depth, error, ret, prunedepth, attic; + int depth, error, ret, prunedepth; wr = l->wr; depth = 0; prunedepth = INT_MAX; as = attrstack_new(); while ((ret = status_get(st, NULL, 0, 0, &sr)) == 1) { - attic = 0; switch (sr->sr_type) { case SR_DIRDOWN: depth++; @@ -194,20 +193,24 @@ lister_coll(struct lister *l, struct col goto bad; } break; -#if 0 case SR_FILEDEAD: - attic = 1; + if (depth < prunedepth) { + if (!(coll->co_options & CO_CHECKOUTMODE)) { + error = lister_dorcsdead(l, coll, sr); + if (error) + goto bad; + } + } + break; case SR_FILELIVE: if (depth < prunedepth) { if (!(coll->co_options & CO_CHECKOUTMODE)) { - error = lister_dorcsfile(l, coll, sr, - attic); + error = lister_dorcsfile(l, coll, sr); if (error) goto bad; } } break; -#endif } } if (ret == -1) { @@ -402,18 +405,15 @@ send: return (0); } -#if 0 -/* Handle a file live or file dead entry found in the status file. */ +/* Handle a rcs file live entry found in the status file. */ static int -lister_dorcsfile(struct lister *l, struct coll *coll, struct statusrec *sr, - int attic) +lister_dorcsfile(struct lister *l, struct coll *coll, struct statusrec *sr) { struct config *config; struct stream *wr; const struct fattr *sendattr; struct fattr *fa; char *path, *spath; - char cmd; size_t len; int error; @@ -422,7 +422,7 @@ lister_dorcsfile(struct lister *l, struc config = l->config; wr = l->wr; if (!coll->co_options & CO_TRUSTSTATUSFILE) { - path = cvspath(coll->co_prefix, sr->sr_file, attic); + path = cvspath(coll->co_prefix, sr->sr_file, 0); if (path == NULL) { spath = coll_statuspath(coll); xasprintf(&l->errmsg, "Error in \"%s\": " @@ -434,9 +434,11 @@ lister_dorcsfile(struct lister *l, struc free(path); } else fa = sr->sr_clientattr; - /* XXX: Perhaps check attic path name here. */ - cmd = attic ? 'F' : 'f'; if (fattr_equal(fa, sr->sr_clientattr)) { + /* + * If the file is an RCS file, we use "loose" equality, so sizes + * may disagress because of differences in whitespace. + */ if (isrcs(sr->sr_file, &len) && !(coll->co_options & CO_NORCS) && !(coll->co_options & CO_STRICTCHECKRCS)) { @@ -444,15 +446,18 @@ lister_dorcsfile(struct lister *l, struc } sendattr = fa; } else { + /* + * If different, the user may have changed it, so we report + * bogus attributes to force a full comparison. + */ sendattr = fattr_bogus; } - error = proto_printf(wr, "%c %s %F\n", cmd, pathlast(sr->sr_file), fa, + error = proto_printf(wr, "F %s %F\n", pathlast(sr->sr_file), sendattr, config->fasupport, coll->co_attrignore); if (error) return (LISTER_ERR_WRITE); return (0); } -#endif /* Handle a checkout dead entry found in the status file. */ static int @@ -508,3 +513,57 @@ lister_dodead(struct lister *l, struct c return (LISTER_ERR_WRITE); return (0); } + +/* Handle a rcs file dead entry found in the status file. */ +static int +lister_dorcsdead(struct lister *l, struct coll *coll, struct statusrec *sr) +{ + struct config *config; + struct stream *wr; + const struct fattr *sendattr; + struct fattr *fa; + char *path, *spath; + size_t len; + int error; + + if (!globtree_test(coll->co_filefilter, sr->sr_file)) + return (0); + config = l->config; + wr = l->wr; + if (!coll->co_options & CO_TRUSTSTATUSFILE) { + path = cvspath(coll->co_prefix, sr->sr_file, 1); + if (path == NULL) { + spath = coll_statuspath(coll); + xasprintf(&l->errmsg, "Error in \"%s\": " + "Invalid filename \"%s\"", spath, sr->sr_file); + free(spath); + return (LISTER_ERR_STATUS); + } + fa = fattr_frompath(path, FATTR_NOFOLLOW); + free(path); + } else + fa = sr->sr_clientattr; + if (fattr_equal(fa, sr->sr_clientattr)) { + /* + * If the file is an RCS file, we use "loose" equality, so sizes + * may disagress because of differences in whitespace. + */ + if (isrcs(sr->sr_file, &len) && + !(coll->co_options & CO_NORCS) && + !(coll->co_options & CO_STRICTCHECKRCS)) { + fattr_maskout(fa, FA_SIZE); + } + sendattr = fa; + } else { + /* + * If different, the user may have changed it, so we report + * bogus attributes to force a full comparison. + */ + sendattr = fattr_bogus; + } + error = proto_printf(wr, "f %s %F\n", pathlast(sr->sr_file), sendattr, + config->fasupport, coll->co_attrignore); + if (error) + return (LISTER_ERR_WRITE); + return (0); +}