Index: subversion/include/svn_io.h =================================================================== --- subversion/include/svn_io.h (revision 19916) +++ subversion/include/svn_io.h (working copy) @@ -305,7 +305,8 @@ apr_pool_t *pool); -/** Minimally change the read-write permissions of a file. +/** Same as svn_io_set_file_read_write_perms. + * Change the read-write permissions of a file. * @since New in 1.1. * * When making @a path read-write on operating systems with unix style @@ -321,14 +322,40 @@ * * @a path is the utf8-encoded path to the file. If @a enable_write * is @c TRUE, then make the file read-write. If @c FALSE, make it - * write-only. If @a ignore_enoent is @c TRUE, don't fail if the target + * read-only. If @a ignore_enoent is @c TRUE, don't fail if the target * file doesn't exist. + * + * @deprecated Provided for backward compatibility with the 1.1 API. */ svn_error_t *svn_io_set_file_read_write_carefully(const char *path, svn_boolean_t enable_write, svn_boolean_t ignore_enoent, apr_pool_t *pool); +/** Change the read-write permissions of a file. + * @since New in 1.5. + * + * When making @a path read-write on operating systems with unix style + * permissions, set the permissions on @a path to the permissions that + * are set when a new file is created (effectively honoring the user's + * umask). + * + * When making the file read-only on operating systems with unix style + * permissions, remove all write permissions. + * + * On other operating systems, toggle the file's "writability" as much as + * the operating system allows. + * + * @a path is the utf8-encoded path to the file. If @a enable_write + * is @c TRUE, then make the file read-write. If @c FALSE, make it + * read-only. If @a ignore_enoent is @c TRUE, don't fail if the target + * file doesn't exist. + */ +svn_error_t *svn_io_set_file_read_write_perms(const char *path, + svn_boolean_t enable_write, + svn_boolean_t ignore_enoent, + apr_pool_t *pool); + /** Toggle a file's "executability". * * When making the file executable on operating systems with unix style Index: subversion/libsvn_wc/props.c =================================================================== --- subversion/libsvn_wc/props.c (revision 19916) +++ subversion/libsvn_wc/props.c (working copy) @@ -1598,8 +1598,8 @@ to read-write */ if (value == NULL) { - SVN_ERR(svn_io_set_file_read_write_carefully(path, TRUE, - FALSE, pool)); + SVN_ERR(svn_io_set_file_read_write_perms(path, TRUE, + FALSE, pool)); } else { Index: subversion/libsvn_wc/log.c =================================================================== --- subversion/libsvn_wc/log.c (revision 19916) +++ subversion/libsvn_wc/log.c (working copy) @@ -425,8 +425,8 @@ { /* No need to make a new file read_write: new files already are. */ if (same) - SVN_ERR(svn_io_set_file_read_write_carefully(filepath, TRUE, - FALSE, pool)); + SVN_ERR(svn_io_set_file_read_write_perms(filepath, TRUE, + FALSE, pool)); *overwrote_working = TRUE; /* entry needs wc-file's timestamp */ } else Index: subversion/libsvn_wc/adm_ops.c =================================================================== --- subversion/libsvn_wc/adm_ops.c (revision 19916) +++ subversion/libsvn_wc/adm_ops.c (working copy) @@ -2348,8 +2348,8 @@ SVN_ERR(svn_wc_prop_get(&needs_lock, SVN_PROP_NEEDS_LOCK, path, adm_access, pool)); if (needs_lock) - SVN_ERR(svn_io_set_file_read_write_carefully(path, TRUE, - FALSE, pool)); + SVN_ERR(svn_io_set_file_read_write_perms(path, TRUE, + FALSE, pool)); } return SVN_NO_ERROR; @@ -2382,8 +2382,8 @@ SVN_ERR(svn_wc_prop_get(&needs_lock, SVN_PROP_NEEDS_LOCK, path, adm_access, pool)); if (needs_lock) - SVN_ERR(svn_io_set_file_read_write_carefully(path, FALSE, - FALSE, pool)); + SVN_ERR(svn_io_set_file_read_write_perms(path, FALSE, + FALSE, pool)); } return SVN_NO_ERROR; Index: subversion/libsvn_wc/translate.c =================================================================== --- subversion/libsvn_wc/translate.c (revision 19916) +++ subversion/libsvn_wc/translate.c (working copy) @@ -270,8 +270,8 @@ if (needs_lock != NULL) { - SVN_ERR(svn_io_set_file_read_write_carefully(path, FALSE, - FALSE, pool)); + SVN_ERR(svn_io_set_file_read_write_perms(path, FALSE, + FALSE, pool)); if (did_set) *did_set = TRUE; } Index: subversion/libsvn_subr/io.c =================================================================== --- subversion/libsvn_subr/io.c (revision 19916) +++ subversion/libsvn_subr/io.c (working copy) @@ -1256,6 +1256,25 @@ svn_boolean_t ignore_enoent, apr_pool_t *pool) { + return svn_io_set_file_read_write_perms(path, enable_write, + ignore_enoent, pool); +} + +svn_error_t * +svn_io_set_file_read_write_perms(const char *path, + svn_boolean_t enable_write, + svn_boolean_t ignore_enoent, + apr_pool_t *pool) +{ +#ifdef WIN32 + /* On Windows just call our normal read/read-write functions. */ + { + if (enable_write) + return svn_io_set_file_read_write(path, ignore_enoent, pool); + return svn_io_set_file_read_only(path, ignore_enoent, pool); + } +#else + apr_status_t status; const char *path_apr; apr_finfo_t finfo; @@ -1344,6 +1363,8 @@ return SVN_NO_ERROR; } return SVN_NO_ERROR; + +#endif } svn_error_t *