Date: Sun, 23 Nov 2008 16:44:49 +0000 (UTC) From: Ulf Lilleengen <lulf@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r185211 - projects/csup_cvsmode/contrib/csup Message-ID: <200811231644.mANGins6057436@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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).
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811231644.mANGins6057436>