[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Repository root relative url support in svn CLI -- REDUX

From: Troy Curtis Jr <troycurtisjr_at_gmail.com>
Date: Tue, 12 Feb 2008 23:46:19 -0600

From my original patch (http://svn.haxx.se/dev/archive-2007-11/0708.shtml)
through discussions about a better implementation
(http://svn.haxx.se/dev/archive-2007-11/1113.shtml and
 http://svn.haxx.se/dev/archive-2007-12/0047.shtml) I have returned with a
better relative url implementation for the svn client, at least so I believe.

In this patch I implement the following logic for parsing the svn CLI
client args:
- If there is a relative url in the target list
  - Then use the repository root url from the other targets to resolve the
    relative url.
  - If there are no other targets, use the root url of the current directory.
  - If the current directory is not a working copy, issue an error.

This seems to get most of the use cases right. It does leave multi-repository
urls out, but they are much less frequent and we couldn't come up with a
simple (to understand) method of resolving them.

This patch contains what is likely a ridiculous amount of svn tests, basically
one for every command of interest to relative urls. It might be too much
because ultimately they all run the same function. However, I had them from
my previous attempt (in which each svn subcommand had it's own implementation)
and I figured they could be useful in making sure checks and translations
don't get made before the call to svn_cl__args_to_target_array() that break
relative url support.

Here's my log message:

[[[
Implement repository root relative url support for the svn command-line
client.

Create some infrastructure:

* subversion/libsvn_subr/path.c
  (svn_path_is_relative_url): New function to test whether a given string is a
   relative url.
  (svn_path_resolve_relative_url): New function to resolve a relative url
   given the repository root url.

* subversion/include/svn_path.h
  (svn_path_is_relative_url): New function prototype.
  (svn_path_resolve_relative_url): New function prototype.

* subversion/tests/libsvn_subr/path-test.c
  (test_is_relative_url): New test.
  (test_resolve_relative_url): New test.
  (test_funcs): Run new tests.

* subversion/libsvn_subr/opt.c
  (svn_opt_args_to_target_array3): Allow a bare relative url for the root of a
   repository ('^/') by testing whether a given argument is a relative url
   before attempting to canonicalize it.

* subversion/libsvn_client/externals.c
  (resolve_relative_external_url): Include a brief note mentioning the fact
   there is a partial reimplementation in libsvn_subr/path.c.

Add relative url support to the svn command-line client:

* subversion/svn/util.c
  (svn_cl__args_to_target_array_print_reserved): Replace this function with a
   more generically named svn_cl__args_to_target_array().
  (svn_cl__args_to_target_array): Resolve repository root relative urls in the
   arguments and known_targets.

* subversion/svn/cl.h
  (svn_cl__args_to_target_array_print_reserved): Deleted old function
   prototype.
  (svn_cl__args_to_target_array): Add new function prototype.

* subversion/svn/propdel-cmd.c,
  subversion/svn/merge-cmd.c,
  subversion/svn/checkout-cmd.c,
  subversion/svn/move-cmd.c,
  subversion/svn/mkdir-cmd.c,
  subversion/svn/cat-cmd.c,
  subversion/svn/revert-cmd.c,
  subversion/svn/diff-cmd.c,
  subversion/svn/copy-cmd.c,
  subversion/svn/mergeinfo-cmd.c,
  subversion/svn/list-cmd.c,
  subversion/svn/blame-cmd.c,
  subversion/svn/propget-cmd.c,
  subversion/svn/changelist-cmd.c,
  subversion/svn/log-cmd.c,
  subversion/svn/resolved-cmd.c,
  subversion/svn/cleanup-cmd.c,
  subversion/svn/commit-cmd.c,
  subversion/svn/add-cmd.c,
  subversion/svn/propset-cmd.c,
  subversion/svn/switch-cmd.c,
  subversion/svn/delete-cmd.c,
  subversion/svn/import-cmd.c,
  subversion/svn/proplist-cmd.c,
  subversion/svn/export-cmd.c,
  subversion/svn/status-cmd.c,
  subversion/svn/propedit-cmd.c,
  subversion/svn/lock-cmd.c,
  subversion/svn/info-cmd.c,
  subversion/svn/unlock-cmd.c
  (svn_cl__add, svn_cl__blame, svn_cl__cat, svn_cl__changelist,
   svn_cl__checkout, svn_cl__cleanup, svn_cl__commit, svn_cl__copy,
   svn_cl__delete, svn_cl__diff, svn_cl__export, svn_cl__import, svn_cl__info,
   svn_cl__list, svn_cl__lock, svn_cl__log, svn_cl__merge, svn_cl__mergeinfo,
   svn_cl__mkdir, svn_cl__move, svn_cl__propdel, svn_cl__propedit,
   svn_cl__propget, svn_cl__proplist, svn_cl__propset, svn_cl__resolved,
   svn_cl__revert, svn_cl__status, svn_cl__switch, svn_cl__unlock):
    Replaced the usage of svn_cl__args_to_target_array_print_reserved() with
    the more generically named svn_cl__args_to_target_array() which combines
    the original function's functionality with relative url resolution.
  (svn_cl__diff): Add access to the client context handle.

* subversion/svn/update-cmd.c
  (svn_cl__update): Replace svn_opt_args_to_target_array3() with
   svn_cl__args_to_target_array().

* subversion/tests/cmdline/cat_tests.py
  (cat_relative_url): New test.
  (test_list): Run it.

* subversion/tests/cmdline/checkout_tests.py
  (co_with_relative_url): New test.
  (test_list): Run it.

* subversion/tests/cmdline/copy_tests.py
  (copy_with_relative_urls): New test.
  (test_list): Run it.

* subversion/tests/cmdline/diff_tests.py
  (diff_relative_url): New test.
  (test_list): Run it.

* subversion/tests/cmdline/export_tests.py
  (export_relative_url): New test.
  (test_list): Run it.

* subversion/tests/cmdline/import_tests.py
  (import_to_relative_url): New test.
  (test_list): Run it.

* subversion/tests/cmdline/lock_tests.py
  (lock_file_with_relative_url): New test.
  (test_list): Run it.

* subversion/tests/cmdline/log_tests.py
  (log_with_relative_urls): New test.
  (test_list): Run it.

* subversion/tests/cmdline/merge_tests.py
  (merge_with_relative_urls): New test.
  (test_list): Run it.

* subversion/tests/cmdline/prop_tests.py
  (url_props_relative_url): New test.
  (test_list): Run it.

* subversion/tests/cmdline/switch_tests.py
  (switch_with_relative_url): New test.
  (test_list): Run it.

* subversion/tests/cmdline/blame_tests.py
  (blame_relative_url): New test.
  (test_list): Run it.
]]]

Troy

-- 
Beware of spyware. If you can, use the Firefox browser. - USA Today
Download now at http://getfirefox.com
Registered Linux User #354814 ( http://counter.li.org/)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

Received on 2008-02-13 06:46:32 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.