[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: Neels J Hofmeyr <neels_at_elego.de>
Date: Sun, 19 Oct 2008 00:36:12 +0200

Tom Naughton wrote:
> 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);

Btw, this is bad. You have two consecutive lines that start with `err =
...', and you don't check whether an error actually occurs. If the first
operation has an error, the second one overwrites it.

> 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?

Hmm, could you send an (if possible complete and runnable) code sample that
reproduces the problem? Maybe you found a bug.

Thanks!
~Neels

>
> Tom
>

-- 
Neels Hofmeyr -- elego Software Solutions GmbH
Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
phone: +49 30 23458696  mobile: +49 177 2345869  fax: +49 30 23458695
http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelsreg: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194

Received on 2008-10-19 00:36:34 CEST

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