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

RE: absolute paths in svn_wc_notify_t

From: Bert Huijben <bert_at_vmoo.com>
Date: Thu, 16 Oct 2008 11:09:39 +0200

                Hi Tom,

 

The fix for this issue is in trunk. I noticed the same problem while
building SharpSvn and using it from AnkhSVN 2.0, but this was just after 1.5
was branched.

 

This method of using the path was unreliable before 1.5 as well L

It all depends on your current directory related to the commit location. The
used base directory is the common ancestor of the commit locations and your
current working directory.

 

In trunk/1.6 you will always receive an absolute path and optionally the
prefix in a separate variable of svn_wc_notify_t. (The UI than has the
option of extracting the prefix or leaving it to always real absolute or
relative paths).

 

The lock functions have the same problem in 1.5 and where fixed in the same
way for 1.6. This change can't be ported back to 1.5 as it changes the
svn_wc_notify_t structure.

 

                Bert

 

From: Tom Naughton [mailto:naughtont_at_gmail.com]
Sent: Wednesday, October 15, 2008 11:42 PM
To: dev_at_subversion.tigris.org
Subject: absolute paths in svn_wc_notify_t

 

I have an application that uses version 1.5.2 of the client library APIs.
I've set up the notify_func2 in my svn_client_ctx_t to point to a callback.

 

Before 1.5, I relied on 'path' in svn_wc_notify_t to point to an absolute
path. Now for commit operations (and only commit operations), I'm getting
partial paths that have had some prefix removed. Is there some way to
determine what this prefix will be or even better, opt to receive absolute
paths instead? According to the comments in svn_wc.h this path is "either
absolute or relative to the current working directory". But I haven't found
that to be the case. In some cases the prefix that is removed is just "/".

 

Stepping through the subversion code I've been able to derive an algorithm
for determining the prefix that will be removed:

 

    // Determine prefix stripped from the commit notify messages

    const char *display_dir = "";

    const char *base_dir = nil;

    svn_depth_t depth = svn_depth_infinity;

    apr_array_header_t *rel_targets;

    err = svn_path_condense_targets(&base_dir, &rel_targets, commit_targets,
depth == svn_depth_infinity, pool);

    err = svn_path_get_absolute(&display_dir,display_dir, pool);

    display_dir = svn_path_get_longest_ancestor(display_dir, base_dir,
pool);

 

If the current directory is something like "/Objects/Debug" and all of the
paths in commit_targets are outside of /Objects,
svn_path_get_longest_ancestor returns "/", and that's what I'm seeing in my
unit tests.

 

Is there a better way to figure out this prefix?

 

Tom

 
Received on 2008-10-16 11:10:13 CEST

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