Cannot use svn_relpath_join() for path created in svn_client__path_relative_to_root()

View: New views
2 Messages — Rating Filter:   Alert me  

Cannot use svn_relpath_join() for path created in svn_client__path_relative_to_root()

by Daniel Näslund :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

When trying to replace svn_path_join() in libvn_client/merge.c I for
some reasson cannot use svn_relpath_join() with a path created in
svn_client_path__relative_to_root() as base.

* libsvn_client/merge.c
  (do_directory_merge): Creates mergeinfo_path with a call to
    svn_client__path_relative_to_root(). Calls
    record_mergeinfo_for_dir_merge().

* libsvn_client/merge.c
  (record_mergeinfo_for_dir_merge): Contains the following snippet
starting on line 6906. If I replace svn_path_join() with svn_uri_join()
everything works fine but if I use svn_relpath_join() then shabang!
Almost every merge_test fails.

[[[
          child_repos_path = svn_dirent_is_child(merge_b->target_abspath,
                                                 child->abspath, iterpool);
          if (!child_repos_path)
            child_repos_path = "";

          child_merge_src_canon_path = svn_path_join(mergeinfo_path,
                                                     child_repos_path,
                                                      iterpool);
]]]

/Daniel

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2415091

Re: Cannot use svn_relpath_join() for path created in svn_client__path_relative_to_root()

by Daniel Näslund :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Nov 06, 2009 at 02:33:44PM +0100, Daniel Näslund wrote:

> Hi!
>
> When trying to replace svn_path_join() in libvn_client/merge.c I for
> some reasson cannot use svn_relpath_join() with a path created in
> svn_client_path__relative_to_root() as base.
>
> * libsvn_client/merge.c
>   (do_directory_merge): Creates mergeinfo_path with a call to
>     svn_client__path_relative_to_root(). Calls
>     record_mergeinfo_for_dir_merge().
>
> * libsvn_client/merge.c
>   (record_mergeinfo_for_dir_merge): Contains the following snippet
> starting on line 6906. If I replace svn_path_join() with svn_uri_join()
> everything works fine but if I use svn_relpath_join() then shabang!
> Almost every merge_test fails.

svn_dirent_uri.h says this:
[[[

 *  - a URI is an absolute path that starts with a '/' or a schema definition.
 *    Examples: "/", "/foo", "http://server", "svn+ssh://user@host:123/file"
 *    But not: "file", "dir/file", "A:/dir"
 *    ### Currently the URI implementation still allows relpaths as valid
 *    uris, but this will change soon.
 *
 *  - a relative path (relpath) is an unrooted path that can be joined to
 *    any other relative path, uri or dirent. A relative path is never
 *    rooted/prefixed by a '/'.
 *    Examples: "file", "dir/file", "dir/subdir/../file"
 *    But not: "/file", "http://server/file"
]]]

So 'path relative to root' really is an absolute path! Doh! Double doh!
The doc string of record_mergeinfo_for_dir_merge() called mergeinfo_path
a repository relative path. I saw the same things in other places. I
propose that we use another naming strategy for paths that is relative
to the repository root! Why not absolute to the repository root?

/Daniel

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2415105