Hello,

I found a little bug with slashes in paths of the svn proplist output;
this patch would fix it.

[[[
Fix bug: svn proplist command prints slashes of incorrect style.

If the proplist command is invoked from a working copy, but it has to make a
request to a server, it will print paths in internal style.

Command to reproduce:
C:\> svn proplist -r HEAD svn-trunk
Properties on 'https:\\svn.apache.org\repos\asf\subversion\trunk':
  svn:auto-props
  svn:ignore
  svn:mergeinfo

Expected output:
-Properties on 'https:\\svn.apache.org\repos\asf\subversion\trunk':
+Properties on 'https://svn.apache.org/repos/asf/subversion/trunk':
   svn:auto-props
   svn:ignore
   svn:mergeinfo

* subversion/svn/proplist-cmd.c
  (proplist_baton_t): Remove is_url field.
  (proplist_receiver_xml, proplist_receiver): Use the svn_path_is_url()
   instead of the field from a baton to determine if the path url or not.
  (svn_cl__proplist): Do not initialize the is_url field of the baton.
* subversion/tests/cmdline/prop_tests.py
  (list_remote_props_by_path): New test.
  (test_list): Run new test.
]]]

--
Timofei Zhakov
Index: subversion/svn/proplist-cmd.c
===================================================================
--- subversion/svn/proplist-cmd.c       (revision 1917991)
+++ subversion/svn/proplist-cmd.c       (working copy)
@@ -45,7 +45,6 @@
 typedef struct proplist_baton_t
 {
   svn_cl__opt_state_t *opt_state;
-  svn_boolean_t is_url;
 } proplist_baton_t;
 
 
@@ -61,7 +60,6 @@ proplist_receiver_xml(void *baton,
                       apr_pool_t *pool)
 {
   svn_cl__opt_state_t *opt_state = ((proplist_baton_t *)baton)->opt_state;
-  svn_boolean_t is_url = ((proplist_baton_t *)baton)->is_url;
   svn_stringbuf_t *sb;
   const char *name_local;
 
@@ -93,7 +91,7 @@ proplist_receiver_xml(void *baton,
       svn_pool_destroy(iterpool);
     }
 
-  if (! is_url)
+  if (! svn_path_is_url(path))
     name_local = svn_dirent_local_style(path, pool);
   else
     name_local = path;
@@ -129,10 +127,9 @@ proplist_receiver(void *baton,
                   apr_pool_t *pool)
 {
   svn_cl__opt_state_t *opt_state = ((proplist_baton_t *)baton)->opt_state;
-  svn_boolean_t is_url = ((proplist_baton_t *)baton)->is_url;
   const char *name_local;
 
-  if (! is_url)
+  if (! svn_path_is_url(path))
     name_local = svn_dirent_local_style(path, pool);
   else
     name_local = path;
@@ -281,7 +278,6 @@ svn_cl__proplist(apr_getopt_t *os,
           svn_pool_clear(iterpool);
           SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
 
-          pl_baton.is_url = svn_path_is_url(target);
           pl_baton.opt_state = opt_state;
 
           /* Check for a peg revision. */
Index: subversion/tests/cmdline/prop_tests.py
===================================================================
--- subversion/tests/cmdline/prop_tests.py      (revision 1917991)
+++ subversion/tests/cmdline/prop_tests.py      (working copy)
@@ -2860,7 +2860,34 @@ def tmpfile_name_matches_prop_type(sbox):
     'ignored-propname',
     sbox.ospath('A/mu'))
 
+def list_remote_props_by_path(sbox):
+  "list remote properties by path (from working copy)"
 
+  sbox.build()
+
+  # Add a couple of properties
+  sbox.simple_propset("prop1", "foo", '.')
+
+  # Commit
+  sbox.simple_commit()
+
+  svntest.actions.run_and_verify_svn(
+    [ "Properties on '" + sbox.repo_url + "':\n",
+      "  prop1\n"], [],
+    'proplist', sbox.wc_dir, "-r", "HEAD")
+
+  svntest.actions.run_and_verify_svn(
+    ['<?xml version="1.0" encoding="UTF-8"?>\n',
+      '<properties>\n',
+      '<target\n',
+      '   path="' + sbox.repo_url + '">\n',
+      '<property\n',
+      '   name="prop1"/>\n',
+      '</target>\n',
+      '</properties>\n'], [],
+    'proplist', sbox.wc_dir, "-r", "HEAD", "--xml")
+
+
 ########################################################################
 # Run the tests
 
@@ -2913,6 +2940,7 @@ test_list = [ None,
               wc_propop_on_url,
               prop_conflict_root,
               tmpfile_name_matches_prop_type,
+              list_remote_props_by_path,
              ]
 
 if __name__ == '__main__':

Reply via email to