On 07.02.2017 21:34, Stefan Sperling wrote:
> On Tue, Feb 07, 2017 at 08:17:41PM +0100, Stefan Kueng wrote:
>> I figured out the problem:
>> to get updated descriptions, I have to call
>> svn_client_conflict_tree_get_resolution_options() again to get new updated
>> options. I can't just get the description from the option I set the move
>> target index to.
>>
>> this won't work:
>> svn_client_conflict_option_set_moved_to_abspath(opt, j, m_pctx,
>> scratchpool);
>>
>> label = svn_client_conflict_option_get_label(opt, scratchpool);
>> description = svn_client_conflict_option_get_description(opt, scratchpool);
>>
>>
>> but this works:
>> svn_client_conflict_option_set_moved_to_abspath(opt, j, m_pctx,
>> scratchpool);
>>
>> // now get the resolution options again, so the label/description is
>> // properly updated.
>> apr_array_header_t *opts;
>> SVNTRACE(
>> Err = svn_client_conflict_tree_get_resolution_options(&opts, m_conflict,
>> m_pctx,
>> result.GetPool(), scratchpool),
>> path
>> );
>> auto o = svn_client_conflict_option_find_by_id(opts, id);
>>
>> label = svn_client_conflict_option_get_label(o, scratchpool);
>> description = svn_client_conflict_option_get_description(o, scratchpool);
>>
>>
>> maybe the docs should be updated to say that a call to
>> svn_client_conflict_tree_get_resolution_options is required to get updated
>> strings?
>
> I'm guessing that you are mixing up repository paths and working copy paths.
> Perhaps your expectation is that a repository-side path in the conflict
> description is changed by svn_client_conflict_option_set_moved_to_abspath()?
> If you do, then the API's behaviour will seem confusing indeed.
>
> There are two kinds of paths which can be selected:
>
> svn_client_conflict_option_set_moved_to_repos_relpath() selects the
> repository path which corresponds to the move target. This is the important
> path to worry about. In the example I gave earlier, this selects between
> '^/trunk/alpha2' and '^/trunk/alpha3'.
> Your examples don't seem to be calling this function.
Sorry, my mistake: I copied the wrong part of the code above. Here's
what I'm doing now:
apr_array_header_t *possible_moved_to_repos_relpaths = nullptr;
Err = svn_client_conflict_option_get_moved_to_repos_relpath_candidates
(&possible_moved_to_repos_relpaths, opt, result.GetPool(),
scratchpool);
if ((Err == nullptr) && possible_moved_to_repos_relpaths &&
(possible_moved_to_repos_relpaths->nelts > 1))
{
for (int j = 0; j < possible_moved_to_repos_relpaths->nelts; ++j)
{
svn_client_conflict_option_set_moved_to_repos_relpath(opt, j,
scratchpool);
// now get the resolution options again, so the
label/description is
// properly updated.
// Note: without this, the label and description text is NOT
updated!
// calling svn_client_conflict_option_get_description on 'opt'
// instead of 'o' will get the existing description, not the
// updated one, even though we set the move index on 'opt'.
apr_array_header_t *opts;
SVNTRACE(
Err = svn_client_conflict_tree_get_resolution_options(&opts,
m_conflict, m_pctx, result.GetPool(), scratchpool),
path
);
auto o = svn_client_conflict_option_find_by_id(opts, id);
if (0 == nullptr)
continue;
label = svn_client_conflict_option_get_label(o, scratchpool);
description = svn_client_conflict_option_get_description(o,
scratchpool);
result.push_back(std::unique_ptr<SVNConflictOption>(new
SVNConflictOption(o, id,
CUnicodeUtils::GetUnicode(label),
CUnicodeUtils::GetUnicode(description), -1, j)));
bResultAdded = true;
}
}
But as I mentioned: without getting the options again with
svn_client_conflict_tree_get_resolution_options, the strings are not
updated. If you look at the svn code: the
svn_client_conflict_option_set_moved_to_repos_relpath call sets the
index to the options object, but does *not* update the strings, and
svn_client_conflict_option_get_description just returns the already
created string.
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest interface to (Sub)version control
/_/ \_\ http://tortoisesvn.net
Received on 2017-02-07 22:21:13 CET