Author: hwright
Date: Mon May 16 15:36:24 2011
New Revision: 1103771
URL: http://svn.apache.org/viewvc?rev=1103771&view=rev
Log:
Convert a bit of the recursive propget to use absolute paths, by doing path
relativifcation in the command line program, where it belongs.
Note: I *think* this is backwards compatible, since we promise paths, but
don't specify absolute or relative in the docs. If somebody has an alternative
interpretation, we can do the API-rev dance.
* subversion/svn/propget-cmd.c
(print_properties): Make a relative path from an absolute one, if possible.
* subversion/svn/propedit-cmd.c
(svn_cl__propedit): Fetch the property from the hash via absolute path.
* subversion/libsvn_client/prop_commands.c
(recursive_propget_receiver_baton): Remove unused members.
(recursive_propset_receiver): Don't make relative paths for the returned
hash.
(get_prop_from_wc): Take an abspath, instead of computing it ourselves.
(get_prop_from_wc): Don't bother computing anchor abspaths and such, just
use our existant abspath to get the property.
Modified:
subversion/trunk/subversion/libsvn_client/prop_commands.c
subversion/trunk/subversion/svn/propedit-cmd.c
subversion/trunk/subversion/svn/propget-cmd.c
Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=1103771&r1=1103770&r2=1103771&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Mon May 16
15:36:24 2011
@@ -758,10 +758,6 @@ struct recursive_propget_receiver_baton
apr_pool_t *pool; /* Pool to allocate additions to PROPS. */
apr_hash_t *changelist_hash; /* Keys are changelists to filter on. */
svn_wc_context_t *wc_ctx; /* Working copy context. */
-
- /* Anchor, anchor_abspath pair for converting to relative paths */
- const char *anchor;
- const char *anchor_abspath;
};
/* An implementation of svn_wc__proplist_receiver_t. */
@@ -772,29 +768,16 @@ recursive_propget_receiver(void *baton,
apr_pool_t *scratch_pool)
{
struct recursive_propget_receiver_baton *b = baton;
- const char *path;
/* If the node doesn't pass changelist filtering, get outta here. */
if (! svn_wc__changelist_match(b->wc_ctx, local_abspath,
b->changelist_hash, scratch_pool))
return SVN_NO_ERROR;
- /* Attempt to convert absolute paths to relative paths for
- * presentation purposes, if needed. */
- if (b->anchor && b->anchor_abspath)
- {
- path = svn_dirent_join(b->anchor,
- svn_dirent_skip_ancestor(b->anchor_abspath,
- local_abspath),
- scratch_pool);
- }
- else
- path = local_abspath;
-
if (apr_hash_count(props))
{
apr_hash_index_t *hi = apr_hash_first(scratch_pool, props);
- apr_hash_set(b->props, apr_pstrdup(b->pool, path),
+ apr_hash_set(b->props, apr_pstrdup(b->pool, local_abspath),
APR_HASH_KEY_STRING,
svn_string_dup(svn__apr_hash_index_val(hi), b->pool));
}
@@ -818,7 +801,7 @@ recursive_propget_receiver(void *baton,
static svn_error_t *
get_prop_from_wc(apr_hash_t *props,
const char *propname,
- const char *target,
+ const char *target_abspath,
svn_boolean_t base_props,
svn_boolean_t pristine,
svn_node_kind_t kind,
@@ -829,10 +812,6 @@ get_prop_from_wc(apr_hash_t *props,
{
apr_hash_t *changelist_hash = NULL;
struct recursive_propget_receiver_baton rb;
- const char *target_abspath;
-
-
- SVN_ERR(svn_dirent_get_absolute(&target_abspath, target, pool));
if (changelists && changelists->nelts)
SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelists, pool));
@@ -850,17 +829,6 @@ get_prop_from_wc(apr_hash_t *props,
rb.wc_ctx = ctx->wc_ctx;
rb.changelist_hash = changelist_hash;
- if (strcmp(target, target_abspath) != 0)
- {
- rb.anchor = target;
- rb.anchor_abspath = target_abspath;
- }
- else
- {
- rb.anchor = NULL;
- rb.anchor_abspath = NULL;
- }
-
/* Fetch the property, recursively or for a single resource. */
if (depth >= svn_depth_files && kind == svn_node_dir)
{
@@ -979,7 +947,7 @@ svn_client_propget3(apr_hash_t **props,
local_abspath, NULL, revision,
pool));
- SVN_ERR(get_prop_from_wc(*props, propname, path_or_url,
+ SVN_ERR(get_prop_from_wc(*props, propname, local_abspath,
FALSE, pristine, kind,
depth, changelists, ctx, pool));
}
Modified: subversion/trunk/subversion/svn/propedit-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propedit-cmd.c?rev=1103771&r1=1103770&r2=1103771&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propedit-cmd.c (original)
+++ subversion/trunk/subversion/svn/propedit-cmd.c Mon May 16 15:36:24 2011
@@ -220,6 +220,9 @@ svn_cl__propedit(apr_getopt_t *os,
svn_pool_clear(subpool);
SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
+ if (!svn_path_is_url(target))
+ SVN_ERR(svn_dirent_get_absolute(&local_abspath, target, subpool));
+
/* Propedits can only happen on HEAD or the working copy, so
the peg revision can be as unspecified. */
peg_revision.kind = svn_opt_revision_unspecified;
@@ -232,7 +235,10 @@ svn_cl__propedit(apr_getopt_t *os,
NULL, ctx, subpool));
/* Get the property value. */
- propval = apr_hash_get(props, target, APR_HASH_KEY_STRING);
+ propval = apr_hash_get(props,
+ svn_path_is_url(target)
+ ? target : local_abspath,
+ APR_HASH_KEY_STRING);
if (! propval)
propval = svn_string_create("", subpool);
@@ -253,8 +259,6 @@ svn_cl__propedit(apr_getopt_t *os,
}
/* Split the path if it is a file path. */
- SVN_ERR(svn_dirent_get_absolute(&local_abspath, target,
subpool));
-
SVN_ERR(svn_wc_read_kind(&kind, ctx->wc_ctx, local_abspath,
FALSE,
subpool));
Modified: subversion/trunk/subversion/svn/propget-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propget-cmd.c?rev=1103771&r1=1103770&r2=1103771&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propget-cmd.c (original)
+++ subversion/trunk/subversion/svn/propget-cmd.c Mon May 16 15:36:24 2011
@@ -117,6 +117,9 @@ print_properties(svn_stream_t *out,
{
apr_hash_index_t *hi;
apr_pool_t *iterpool = svn_pool_create(pool);
+ const char *path_prefix;
+
+ SVN_ERR(svn_dirent_get_absolute(&path_prefix, "", pool));
for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
{
@@ -132,7 +135,12 @@ print_properties(svn_stream_t *out,
/* Print the file name. */
if (! is_url)
- filename = svn_dirent_local_style(filename, iterpool);
+ {
+ if (path_prefix)
+ filename = svn_dirent_skip_ancestor(path_prefix, filename);
+
+ filename = svn_dirent_local_style(filename, iterpool);
+ }
/* In verbose mode, print exactly same as "proplist" does;
* otherwise, print a brief header. */