here's a fix for issue #591 (svn cp URLfile localpath doesn't preserve
properties).
-garrett
When copying a file from the repository to the working copy, preserve
any properties the file had set on it. This fixes issue $591.
* subversion/include/svn_ra.h
(get_file): add a 'props' argument, which holds a pointer to an
apr_hash_t * that will contain the properties of the file retrieved.
update docstring appropriately.
* subversion/libsvn_ra_local/ra_plugin.c
(get_file): add the propls argument. if props is non-null, fill it
with the properties that are set on the file.
* subversion/libsvn_client/copy.c
(repos_to_wc_copy): when copying a file, pass a props hash to
get_file, and apply the properties to the new copy.
* subversion/libsvn_client/repos_diff.c
(get_file_from_ra): catch up to change in get_file by just passing
NULL for the props argument.
* subversion/libsvn_ra_dav/ra_dav.h
(svn_ra_dav__get_file): add props argument.
* subversion/libsvn_ra_dav/fetch.c
(svn_ra_dav__get_file): if the caller passed in a props hash, fill
it in with the properties of the file.
Index: ./subversion/include/svn_ra.h
===================================================================
--- ./subversion/include/svn_ra.h
+++ ./subversion/include/svn_ra.h Sat Jan 19 19:24:06 2002
@@ -351,12 +351,15 @@
If REVISION is SVN_INVALID_REVNUM (meaning 'head') and
*FETCHED_REV is not NULL, then this function will set
*FETCHED_REV to the actual revision that was retrieved. (Some
- callers want to know, and some don't.) */
+ callers want to know, and some don't.)
+
+ If PROPS is non NULL, it will contain the properties of the file. */
svn_error_t *(*get_file) (void *session_baton,
const char *path,
svn_revnum_t revision,
svn_stream_t *stream,
- svn_revnum_t *fetched_rev);
+ svn_revnum_t *fetched_rev,
+ apr_hash_t **props);
/* Check out revision REVISION of the url specified in
Index: ./subversion/libsvn_ra_local/ra_plugin.c
===================================================================
--- ./subversion/libsvn_ra_local/ra_plugin.c
+++ ./subversion/libsvn_ra_local/ra_plugin.c Sat Jan 19 19:25:19 2002
@@ -519,7 +519,8 @@
const char *path,
svn_revnum_t revision,
svn_stream_t *stream,
- svn_revnum_t *fetched_rev)
+ svn_revnum_t *fetched_rev,
+ apr_hash_t **props)
{
svn_fs_root_t *root;
svn_stream_t *contents;
@@ -589,6 +590,9 @@
break;
}
}
+
+ if (props)
+ SVN_ERR (svn_fs_node_proplist (props, root, abs_path->data, sbaton->pool));
return SVN_NO_ERROR;
}
Index: ./subversion/libsvn_client/copy.c
===================================================================
--- ./subversion/libsvn_client/copy.c
+++ ./subversion/libsvn_client/copy.c Sun Jan 20 11:55:49 2002
@@ -534,6 +534,8 @@
svn_stream_t *fstream;
apr_file_t *fp;
svn_revnum_t fetched_rev = 0;
+ apr_hash_t *props;
+ apr_hash_index_t *hi;
/* Open DST_PATH for writing. */
status = apr_file_open (&fp, dst_path->data, (APR_CREATE | APR_WRITE),
@@ -549,7 +551,18 @@
/* Have the RA layer 'push' data at this stream. We pass a
relative path of "", because we opened SRC_URL, which is
already the full URL to the file. */
- SVN_ERR (ra_lib->get_file (sess, "", src_rev, fstream, &fetched_rev));
+ SVN_ERR (ra_lib->get_file (sess, "", src_rev, fstream,
+ &fetched_rev, &props));
+
+ for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
+ {
+ const char *key;
+ svn_string_t *val;
+
+ apr_hash_this(hi, (const void **)&key, NULL, (void **)&val);
+
+ SVN_ERR (svn_wc_prop_set (key, val, dst_path->data, pool));
+ }
/* Close the file. */
status = apr_file_close (fp);
Index: ./subversion/libsvn_client/repos_diff.c
===================================================================
--- ./subversion/libsvn_client/repos_diff.c
+++ ./subversion/libsvn_client/repos_diff.c Sat Jan 19 19:29:12 2002
@@ -254,7 +254,7 @@
SVN_ERR (b->edit_baton->ra_lib->get_file (b->edit_baton->ra_session,
b->path->data,
b->edit_baton->revision,
- fstream, NULL));
+ fstream, NULL, NULL));
status = apr_file_close (file);
if (status)
Index: ./subversion/libsvn_ra_dav/ra_dav.h
===================================================================
--- ./subversion/libsvn_ra_dav/ra_dav.h
+++ ./subversion/libsvn_ra_dav/ra_dav.h Sat Jan 19 19:27:46 2002
@@ -85,7 +85,8 @@
const char *path,
svn_revnum_t revision,
svn_stream_t *stream,
- svn_revnum_t *fetched_rev);
+ svn_revnum_t *fetched_rev,
+ apr_hash_t **props);
svn_error_t * svn_ra_dav__abort_commit(
void *session_baton,
Index: ./subversion/libsvn_ra_dav/fetch.c
===================================================================
--- ./subversion/libsvn_ra_dav/fetch.c
+++ ./subversion/libsvn_ra_dav/fetch.c Sun Jan 20 12:05:35 2002
@@ -785,8 +785,11 @@
const char *path,
svn_revnum_t revision,
svn_stream_t *stream,
- svn_revnum_t *fetched_rev)
+ svn_revnum_t *fetched_rev,
+ apr_hash_t **props)
{
+ svn_ra_dav_resource_t *rsrc;
+ apr_hash_index_t *hi;
svn_stringbuf_t *url_str;
const char *final_url;
svn_ra_session_t *ras = (svn_ra_session_t *) session_baton;
@@ -828,6 +831,31 @@
get_file_reader, stream,
ras->callbacks->get_wc_prop,
ras->callback_baton, ras->pool) );
+
+ if (props)
+ {
+ SVN_ERR( svn_ra_dav__get_props_resource(&rsrc, ras->sess, final_url,
+ NULL, NULL /* all props */,
+ ras->pool) );
+
+ *props = apr_hash_make(ras->pool);
+
+ for (hi = apr_hash_first(ras->pool, rsrc->propset);
+ hi;
+ hi = apr_hash_next(hi))
+ {
+ const char *key;
+ char *val;
+
+ apr_hash_this(hi, (const void **)&key, NULL, (void **)&val);
+
+#define NSLEN (sizeof(SVN_PROP_CUSTOM_PREFIX) - 1)
+ if (strncmp(key, SVN_PROP_CUSTOM_PREFIX, NSLEN) == 0)
+ apr_hash_set(*props, &key[NSLEN], APR_HASH_KEY_STRING,
+ svn_string_create(val, ras->pool));
+#undef NSLEN
+ }
+ }
return SVN_NO_ERROR;
}
--
garrett rooney Unix was not designed to stop you from
rooneg@electricjellyfish.net doing stupid things, because that would
http://electricjellyfish.net/ stop you from doing clever things.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:57 2006