subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r1415365 - in /subversion/trunk/subversion: svn/info-cmd.c tests/cmdline/info_tests.py
Date Thu, 29 Nov 2012 20:44:48 GMT
Author: cmpilato
Date: Thu Nov 29 20:44:47 2012
New Revision: 1415365

URL: http://svn.apache.org/viewvc?rev=1415365&view=rev
Log:
Show the ^/foo/bar repository relative URL of the item in 'svn info'
output.

* subversion/svn/info-cmd.c
  (print_info): Print a new line of information, "Relative URL:",
    carrying the so-called "caret syntax" of the repository relative URL.
  (print_info_xml): Print "<relative-url>..</relative-url>" in the XML
    display to carry the repository relative URL.

* subversion/tests/cmdline/info_tests.py
  (info_on_added_file, info_on_mkdir, info_repos_root_url): Update
    test expectations.

Modified:
    subversion/trunk/subversion/svn/info-cmd.c
    subversion/trunk/subversion/tests/cmdline/info_tests.py

Modified: subversion/trunk/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/info-cmd.c?rev=1415365&r1=1415364&r2=1415365&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/info-cmd.c (original)
+++ subversion/trunk/subversion/svn/info-cmd.c Thu Nov 29 20:44:47 2012
@@ -102,8 +102,22 @@ print_info_xml(void *baton,
                         "revision", rev_str,
                         NULL);
 
+  /* "<url> xx </url>" */
   svn_cl__xml_tagged_cdata(&sb, pool, "url", info->URL);
 
+  if (info->repos_root_URL)
+    {
+      /* "<relative-url> xx </relative-url>" */
+      svn_cl__xml_tagged_cdata(&sb, pool, "relative-url",
+                               apr_pstrcat(pool, "^/",
+                                           svn_path_uri_encode(
+                                               svn_uri_skip_ancestor(
+                                                   info->repos_root_URL,
+                                                   info->URL, pool),
+                                               pool),
+                                           NULL));
+    }
+
   if (info->repos_root_URL || info->repos_UUID)
     {
       /* "<repository>" */
@@ -308,6 +322,13 @@ print_info(void *baton,
   if (info->URL)
     SVN_ERR(svn_cmdline_printf(pool, _("URL: %s\n"), info->URL));
 
+  if (info->URL && info->repos_root_URL)
+    SVN_ERR(svn_cmdline_printf(pool, _("Relative URL: ^/%s\n"),
+                               svn_path_uri_encode(
+                                   svn_uri_skip_ancestor(info->repos_root_URL,
+                                                         info->URL, pool),
+                                   pool)));
+
   if (info->repos_root_URL)
     SVN_ERR(svn_cmdline_printf(pool, _("Repository Root: %s\n"),
                                info->repos_root_URL));

Modified: subversion/trunk/subversion/tests/cmdline/info_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/info_tests.py?rev=1415365&r1=1415364&r2=1415365&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/info_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/info_tests.py Thu Nov 29 20:44:47 2012
@@ -221,6 +221,7 @@ def info_on_added_file(sbox):
   expected = {'Path' : re.escape(new_file),
               'Name' : 'new_file',
               'URL' : '.*/new_file',
+              'Relative URL' : '.*/new_file',
               'Repository Root' : '.*',
               'Node Kind' : 'file',
               'Schedule' : 'add',
@@ -240,6 +241,7 @@ def info_on_added_file(sbox):
                                      'path'     : new_file,
                                      'revision' : 'Resource is not under version control.'}),
                        ('url',      {}, '.*/new_file'),
+                       ('relative-url', {}, '.*/new_file'),
                        ('root',     {}, '.*'),
                        ('uuid',     {}, uuid_regex),
                        ('depth',    {}, 'infinity'),
@@ -259,6 +261,7 @@ def info_on_mkdir(sbox):
   # check that we have a Repository Root and Repository UUID
   expected = {'Path' : re.escape(new_dir),
               'URL' : '.*/new_dir',
+              'Relative URL' : '.*/new_dir',
               'Repository Root' : '.*',
               'Node Kind' : 'directory',
               'Schedule' : 'add',
@@ -277,6 +280,7 @@ def info_on_mkdir(sbox):
                                      'path'     : new_dir,
                                      'revision' : 'Resource is not under version control.'}),
                        ('url',      {}, '.*/new_dir'),
+                       ('relative-url', {}, '.*/new_dir'),
                        ('root',     {}, '.*'),
                        ('uuid',     {}, uuid_regex),
                        ('depth',    {}, 'infinity'),
@@ -396,6 +400,7 @@ def info_repos_root_url(sbox):
         'Path'              : re.escape(os.path.basename(sbox.repo_dir)),
         'Repository Root'   : re.escape(sbox.repo_url),
         'URL'               : re.escape(sbox.repo_url),
+        'Relative URL'      : '\^/', # escape ^ -- this isn't a regexp
         'Revision'          : '1',
         'Node Kind'         : 'directory',
         'Last Changed Rev'  : '1',
@@ -405,6 +410,7 @@ def info_repos_root_url(sbox):
         'Name'              : 'iota',
         'Repository Root'   : re.escape(sbox.repo_url),
         'URL'               : re.escape(sbox.repo_url + '/iota'),
+        'Relative URL'      : '\^/iota', # escape ^ -- this isn't a regexp
         'Revision'          : '1',
         'Node Kind'         : 'file',
         'Last Changed Rev'  : '1',



Mime
View raw message