From owner-svn-src-projects@FreeBSD.ORG Sun Nov 23 16:44:49 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 B3AF21065670; Sun, 23 Nov 2008 16:44:49 +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 A69BE8FC20; Sun, 23 Nov 2008 16:44:49 +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 mANGinld057438; Sun, 23 Nov 2008 16:44:49 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANGins6057436; Sun, 23 Nov 2008 16:44:49 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200811231644.mANGins6057436@svn.freebsd.org> From: Ulf Lilleengen Date: Sun, 23 Nov 2008 16:44:49 +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: r185211 - 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 16:44:49 -0000 Author: lulf Date: Sun Nov 23 16:44:49 2008 New Revision: 185211 URL: http://svn.freebsd.org/changeset/base/185211 Log: - Make sure comparisons are done on file types as well. - Handle the case where a repository may have been copied, and the symlinks have not been preserved. CVSup removes the files and creates the symlinks, so enable this behaviour in csup as well. - While there, fix comments and style issues. Modified: projects/csup_cvsmode/contrib/csup/fattr.c projects/csup_cvsmode/contrib/csup/updater.c Modified: projects/csup_cvsmode/contrib/csup/fattr.c ============================================================================== --- projects/csup_cvsmode/contrib/csup/fattr.c Sun Nov 23 16:08:36 2008 (r185210) +++ projects/csup_cvsmode/contrib/csup/fattr.c Sun Nov 23 16:44:49 2008 (r185211) @@ -840,6 +840,19 @@ fattr_install(struct fattr *fa, const ch } #endif + /* + * If it is changed from a file to a symlink, remove the file + * and create the symlink. + */ + if (inplace && (fa->type == FT_SYMLINK) && + (old->type == FT_FILE)) { + error = unlink(topath); + if (error) + goto bad; + error = symlink(fa->linktarget, topath); + if (error) + goto bad; + } /* Determine whether we need to remove the target first. */ if (!inplace && (fa->type == FT_DIRECTORY) != (old->type == FT_DIRECTORY)) { @@ -919,6 +932,9 @@ fattr_equal(const struct fattr *fa1, con mask = fa1->mask & fa2->mask; if (fa1->type == FT_UNKNOWN || fa2->type == FT_UNKNOWN) return (0); + if (mask & FA_FILETYPE) + if (fa1->type != fa2->type) + return (0); if (mask & FA_MODTIME) if (fa1->modtime != fa2->modtime) return (0); Modified: projects/csup_cvsmode/contrib/csup/updater.c ============================================================================== --- projects/csup_cvsmode/contrib/csup/updater.c Sun Nov 23 16:08:36 2008 (r185210) +++ projects/csup_cvsmode/contrib/csup/updater.c Sun Nov 23 16:44:49 2008 (r185211) @@ -1255,13 +1255,13 @@ updater_diff_apply(struct updater *up, s /* Update or create a node. */ static int -updater_updatenode(struct updater *up, struct coll *coll, struct file_update *fup, char *name, - char *attr) +updater_updatenode(struct updater *up, struct coll *coll, + struct file_update *fup, char *name, char *attr) { struct fattr *fa, *fileattr; struct status *st; struct statusrec *sr; - int error, issymlink, rv; + int error, rv; sr = &fup->srbuf; st = fup->st; @@ -1270,10 +1270,8 @@ updater_updatenode(struct updater *up, s if (fattr_type(fa) == FT_SYMLINK) { lprintf(1, " Symlink %s -> %s\n", name, fattr_getlinktarget(fa)); - issymlink = 1; } else { lprintf(1, " Mknod %s\n", name); - issymlink = 0; } /* Create directory. */ @@ -1281,11 +1279,11 @@ updater_updatenode(struct updater *up, s if (error) return (UPDATER_ERR_PROTO); - /* If it exists, update attributes. */ + /* If it does not exist, create it. */ if (access(fup->destpath, F_OK) != 0) fattr_makenode(fa, fup->destpath); - - /* + + /* * Coming from attic? I don't think this is a problem since we have * determined attic before we call this function (Look at UpdateNode in * cvsup).