Checkout Tools
  • last updated 7 hours ago
Constraints: committers
Constraints: files
Constraints: dates
Add two resolver options for 'dir move vs dir move upon merge' conflicts.

These new options work similar to their existing counterparts for files.

* subversion/include/svn_client.h


svn_client_conflict_option_both_moved_dir_move_merge): Declare.

* subversion/libsvn_client/conflicts.c


resolve_both_moved_dir_move_merge): New resolution option handlers.


configure_option_both_moved_dir_merge): Enable new options on applicable

tree conflicts.




svn_client_conflict_option_set_moved_to_abspath2): Handle new options.

* subversion/svn/conflict-callbacks.c

(builtin_resolver_options): Assign resolver menu keys to the new options.

* subversion/tests/libsvn_client/conflicts-test.c


test_merge_dir_move_vs_dir_move_accept_move, test_funcs): Add new tests.

(create_dir_move_vs_dir_move_merge_conflict): New helper for above tests.

  1. … 3 more files in changeset.
Add resolver support for incoming move vs local move of files during merges.

Add two new resolution options for move vs move conflicts with files

after a merge operation:

(m) - apply changes to 'file-target' and revert addition of 'file-source'

(M) - move 'file-target' to 'file-source' and merge

where 'file-branch' is the path the file has on the merge target branch,

and 'file-source' is the path the file has on the merge source branch.

The 'm' option applies textual changes only and leaves the tree structure

of the merge target as it is. The 'M' option changes the file's location in

the merge target to match that of the merge source before merging changes.

I have not written related tests yet, but some manual testing was done.

Proper tests will follow as soon.

* subversion/include/svn_client.h


svn_client_conflict_option_both_moved_file_move_merge): Declare new options.

* subversion/libsvn_client/conflicts.c

(follow_move_chains): Check for local candidates along all moves in the

chain, not just for the final move in the chain.

(resolve_incoming_move_file_text_merge): Implement support for the

svn_client_conflict_option_both_moved_file_move_merge option. This case

is similar enough to make sharing code written for other cases possible.

(resolve_both_moved_file_text_merge): New resolution handler for the

svn_client_conflict_option_both_moved_file_merge option.

(configure_option_incoming_delete_ignore): Don't match move-vs-move cases.

This causes the 'ignore deletion' option to show up in actual delete vs.

delete conflict cases as a side-effect.

(configure_option_incoming_delete_accept): Don't match move-vs-move cases.

(describe_incoming_move_merge_conflict_option): Change 'details' parameter

to a move target path, so this function can also be used for the new

svn_client_conflict_option_both_moved_file_move_merge option.


configure_option_incoming_dir_merge): Update callers.

(configure_option_both_moved_file_merge): Configure new options.




svn_client_conflict_option_set_moved_to_abspath2): Accept new options and

update calls to describe_incoming_move_merge_conflict_option().

(svn_client_conflict_tree_get_resolution_options): Enable new options.

* subversion/libsvn_wc/conflicts.c

(svn_wc__guess_incoming_move_target_nodes): Handle the case where the

conflict victim is a 'local missing' victim. Needed for new options.

* subversion/svn/conflict-callbacks.c

(builtin_resolver_options): Set menu key bindings for new options.

  1. … 3 more files in changeset.
* subversion/svn/conflict-callbacks.c

(build_tree_conflict_options): No functional change; fix

indentation to avoid gcc -Wmisleading-indentation warning.

Remove an unused result_pool argument of private function for conflict


* subversion/svn/conflict-callbacks.c


Remove unused (or not properly used) argument

(svn_cl__resolve_conflict): Update caller.

Use an iterpool in the interactive conflict resolver loop.

* subversion/svn/conflict-callbacks.c

(svn_cl__resolve_conflict): Use an iterpool during interactive loop.

Prevents memory exhaustion in case the library keeps returning

SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, which can make 'svn' retry

in an endless loop.

Improve the semantics of four public API resolver functions.

In all cases, the old APIs would raise an assertion failure if an unexpected

option was passed. This is bad API design since it forces clients to maintain

a static copy of the list of valid options. Furthermore, because we're

adding support for new options in future releases, we require API users

to keep this list updated when they update to a newer version of SVN.

The new versions of these APIs return NULL instead of asserting valid input.

This allows clients to simply pass in any option and check if that gives

a valid result.

Do not bother emulating the old behaviour; code written against the

guarantees of the old API will just keep working.

Make use of the new API versions in 'svn', which also serves as an

example of new API semantics are more friendly to API users.

Improve the API docstrings a little while here.

I am declaring the APIs added here as "New in 1.11" in hope that this

change will be backported to the recently created 1.11.x branch.

* subversion/include/svn_client.h


svn_client_conflict_option_set_moved_to_repos_relpath2): New.


svn_client_conflict_option_set_moved_to_repos_relpath): Deprecate.


svn_client_conflict_option_set_moved_to_abspath2): New.


svn_client_conflict_option_set_moved_to_abspath): Deprecate.

* subversion/libsvn_client/conflicts.c


svn_client_conflict_option_set_moved_to_repos_relpath2): New.


svn_client_conflict_option_set_moved_to_repos_relpath): Implement

as a wrapper around the new API.


svn_client_conflict_option_set_moved_to_abspath2): New.


svn_client_conflict_option_set_moved_to_abspath): Implement as a

wrapper around the new API.

* subversion/svn/conflict-callbacks.c

(build_tree_conflict_options): Remove a large list of options which are

acceptable to old APIs. Call the new API and check its result instead.


find_conflict_option_with_working_copy_move_targets): New helper functions.

(handle_tree_conflict): Simplify support of ambiguous moves by using new APIs.

  1. … 2 more files in changeset.
Implement support for ambiguous moves for 'local missing' conflicts.

* subversion/libsvn_client/conflicts.c

(conflict_tree_local_missing_details): Replace the single 'moved_to_abspath'

with appropriate data structures for supporting ambiguous moves: A map

of repository-side move targets and corresponding working copy paths.

The new data structures are similar to those used for 'incoming delete'

style conflicts.

(follow_move_chains): Move upwards in the file so it can be used earlier.

(conflict_tree_get_details_local_missing): Initialize the new map of

repository-side move targets. Again, this is similar to what the

corresponding 'get details' function for 'incoming delete' conflicts does.

(resolve_local_move_file_merge): Replace use of 'merge_target_abspath' with

use of the new move target map.

(configure_option_local_move_file_merge): Stop initializing move information

in conflict details here. This is now done earlier, when the details are

actually fetched from the repository. Doing this here is the wrong place

for the task, since we would clobber move target selections the user may

have already made. And again, the 'incoming delete' case works similar to

this new implementation for 'local missing'.

(get_repos_relpath_candidates): New helper function factored out from...


Support selection of repository move targets with the new 'local missing'

details data structures.

(svn_client_conflict_option_set_moved_to_repos_relpath: Add support for

'local missing' conflicts to this function.

(set_wc_move_target): New helper function, factored out from...


Support the new move data structures used for 'local missing' conflicts.

* subversion/svn/conflict-callbacks.c

(build_tree_conflict_options): Obtain the list of working copy move targets

for 'local missing' options as well as 'incoming delete' style options.

(handle_tree_conflict): Allow choosing ambiguous move targets for

'local missing' style options.

* subversion/tests/libsvn_client/conflicts-test.c

(test_local_missing_abiguous_moves, test_funcs): New test.

  1. … 2 more files in changeset.
Introduce separate conflict option IDs for sibling move cases.

New option IDs had been avoided to make backporting to 1.10 easier.

Since the outstanding backport proposal was retracted in r1839283

it is time to use proper designations to make things less confusing.

* subversion/include/svn_client.h


svn_client_conflict_option_sibling_move_dir_merge): Declare.

* subversion/libsvn_client/conflicts.c


configure_option_sibling_move_merge): Use new options for

sibling move cases instead of overloading the 'local move' IDs.

A 'local move' is a different case.

(init_wc_move_targets): Add sibling move options.

(resolve_local_move_file_merge): Update docstring.


svn_client_conflict_option_set_moved_to_abspath): Add sibling move options.

* subversion/svn/conflict-callbacks.c

(builtin_resolver_options): Assign menu key "m" to sibling move options.

(build_tree_conflict_options, handle_tree_conflict); Support sibling

move options.

* subversion/tests/libsvn_client/conflicts-test.c

(test_cherry_pick_post_move_edit, test_cherry_pick_post_move_edit_dir):

Update test expectations.

  1. … 3 more files in changeset.
For issue #4694, handle cherry-picking across moved directories.

Also, refactor conflict option configuration a bit to clearly

separate local-move options from sibling-move options.

The names of options relating to sibling-moves are still not

ideal but that can be fixed later.

* subversion/libsvn_client/conflicts.c

(conflict_tree_get_details_local_missing): Recommend the

svn_client_conflict_option_local_move_dir_merge option.

(init_wc_move_targets): Handle the

svn_client_conflict_option_local_move_dir_merge option.

(resolve_sibling_move_dir_merge): Implement resolution of

(configure_option_local_move_file_merge): Move sibling-move

releted options out of here.

(configure_option_sibling_move_merge): New helper function

which configures resolution options for sibling move cases,

for both files and directories.


Support svn_client_conflict_option_local_move_dir_merge.

(svn_client_conflict_tree_get_resolution_options): Call the

new configure_option_sibling_move_merge helper function.

* subversion/svn/conflict-callbacks.c

(builtin_resolver_options): Add the new option

svn_client_conflict_option_local_move_dir_merge to list

of known built-in resolver options.

(build_tree_conflict_options): Get abspath candidates

for svn_client_conflict_option_local_move_dir_merge option.

(handle_tree_conflict): Perform ambiguous merge target selection

for svn_client_conflict_option_local_move_dir_merge.

* subversion/tests/libsvn_client/conflicts-test.c

(test_funcs): test_cherry_pick_post_move_edit_dir is now passing.

  1. … 2 more files in changeset.
Fix issue #4694 "cherry-pick edit after file was moved on source branch"

Add conflict resolver support for cherry-picking changes from files which

have been moved on the merge source branch. Support multiple merge target

candidates, and run a file merge by default if only one candidate exists.

This implementation extends the existing "local move file text merge"

resolution option with support for 'move siblings' as merge targets.

I am still considering whether this case conceptually deserves a dedicated

resolution option. However, it would be nice to backport this feature to

SVN 1.10. The only API change required by this implementation is allowing

another 'option' parameter value for the existing API functions


and svn_client_conflict_option_set_moved_to_abspath(). This change is

ABI compatible, with the only caveat that a new 'svn' binary running

on top of an older libsvn_client could trigger an input assertion.

Because we require 'svn' to be kept in sync with the libraries this

should not be a problem in practice.

We can still improve the API for >= 1.11 later.

* subversion/include/private/svn_wc_private.h

(svn_wc__find_working_nodes_with_basename): Declare.

* subversion/include/svn_client.h


svn_client_conflict_option_set_moved_to_abspath): Document that

svn_client_conflict_option_local_move_file_text_merge is now

a valid option parameter for these functions.

* subversion/libsvn_client/conflicts.c

(conflict_tree_local_missing_details): Add and document wc_siblings

and preferred_sibling_idx fields.

(collect_sibling_move_candidates): New helper function.

(conflict_tree_get_details_local_missing): Try to find the 'local missing'

node which corresponds to the conflict victim in the working copy.

Technically, this would require scanning the log for every item in the WC.

However, assuming a cherry-pick from a moved file to a non-moved file, we

can use a short-cut: The basename of the non-moved file is already known

because it must match one of the locations which the moved file was moved

from. So we can restrict tracing of log history to nodes with a basename

which occurs in the chain of file moves on the merge source branch.

(resolve_local_move_file_merge, configure_option_local_move_file_merge):

Add support for merging to WC siblings of conflict victims which are

'locally missing'.


svn_client_conflict_option_set_moved_to_abspath): Add support for the

svn_client_conflict_option_local_move_file_text_merge resolution option.

* subversion/libsvn_wc/node.c

(svn_wc__find_working_nodes_with_basename): New private API function which

simply forwards to wc_db.

* subversion/libsvn_wc/wc-queries.sql


* subversion/libsvn_wc/wc_db.c

(svn_wc__db_find_working_nodes_with_basename): New wc_db API function which

finds present working nodes with a given basename.

* subversion/libsvn_wc/wc_db.h

(svn_wc__db_find_working_nodes_with_basename): Declare.

* subversion/svn/conflict-callbacks.c

(build_tree_conflict_options, handle_tree_conflict): Support multiple merge target

candidates with the svn_client_conflict_option_local_move_file_text_merge option.

* subversion/tests/libsvn_client/conflicts-test.c

(test_funcs): Mark test_cherry_pick_post_move_edit as PASS.

  1. … 8 more files in changeset.
Don't ignore error returns.

c: [skip]

Found by: danielsh

using tools/dev/

  1. … 7 more files in changeset.
* subversion/svn/conflict-callbacks.c

(show_diff): Fix typo in comment.

* subversion/svn/conflict-callbacks.c

(svn_cl__accept_from_word): Fix check for "r" (the shorthand form

of --accept=recommended). Makes basic_test 41 PASS again.

Add a new --accept recommended option to 'svn'.

--accept recommended works like --accept postpone, except that tree

conflicts for which a recommended resolution option exists are

automatically resolved.

* subversion/svn/cl.h

(SVN_CL__ACCEPT_RECOMMENDED): Declare (as string: "recommended").

* subversion/svn/conflict-callbacks.c

(svn_cl__accept_from_word): Handle SVN_CL__ACCEPT_RECOMMENDED and provide

the shorthand form 'r'.

* subversion/svn/svn.c

(svn_cl__options): Update --accept option help text.

* subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout:

Update expected help output.

  1. … 3 more files in changeset.
Make svn --non-interactive use recommended tree conflict resolution

options by default. Previously, it would postpone such conflicts.

This mode is not yet exposed as a separate --accept option argument.

Perhaps we will do that later.

* subversion/svn/cl.h

(svn_cl__accept_recommended): Declare.

* subversion/svn/conflict-callbacks.c

(svn_cl__resolve_conflict): Add support for svn_cl__accept_recommended.

* subversion/svn/merge-cmd.c

(conflict_func_merge_cmd): Add svn_cl__accept_recommended to the switch

statement (as an invalid option to use in this context).

* subversion/svn/svn.c

(sub_main): Default to svn_cl__accept_recommended if --non-interactive.

  1. … 3 more files in changeset.
Make 'svn resolve' warn about ambiguous moves at the conflict prompt.

* subversion/svn/conflict-callbacks.c

(handle_tree_conflict): If ambiguous move destinations exist in the

repository and/or working copy, print an extra line above the conflict

prompt which tells users how they can resolve such ambiguities.

Allow the conflict resolver to recommend resolution options and implement

support for this feature in 'svn resolve'.

Clients can now avoid interactive prompting in cases where resolution

succeeds with the recommended resolution option.

Recommendations are hard-coded in libsvn_client. Since only one possible

option should be recommended, and clients are free to ignore recommendations

made by libsvn_client, I don't see a point in making this configurable.

At present libsvn_client only recommends options for tree conflicts which

involve unambiguous moves, but this is an implementation detail.

In the future, we may want to add an override to 'svn resolve', such as a

new '--accept ask' option, for people who enjoy the conflict prompt so much

that they want to see it all the time.

* subversion/include/svn_client.h

(svn_client_conflict_get_recommended_option_id): Declare.

(svn_client_conflict_tree_resolve): Add another error code to the docstring.

Knowing these error code is now important to client implementors because a

recommended option may fail to resolve a conflict, in which case clients

should fall back to trying other options (and, usually, prompting).

* subversion/libsvn_client/conflicts.c

(svn_client_conflict_t): Add 'recommended_option_id' field.

(init_wc_move_targets): Recommend options for resolving tree conflicts

involving unambiguous moves.

(svn_client_conflict_get_recommended_option_id): New.

(svn_client_conflict_get): Initialize 'recommended_option_id' field.

* subversion/svn/conflict-callbacks.c

(client_option_t) Add 'is_recommended' flag.

(find_recommended_option): New helper function.

(find_option_by_builtin): Add a 'conflict' paramter. Set 'is_recommended'

flag for recommended options.

(build_text_conflict_options, build_prop_conflict_options,

build_tree_conflict_options): Adjust callers of find_option_by_builtin().

(handle_tree_conflict): If an option is recommended, try it before falling

back to the interactive conflict prompt.

  1. … 2 more files in changeset.
Update the conflict option description when a move target relpath is changed

via the svn_client_conflict_option_set_moved_to_repos_relpath() API.


* subversion/include/svn_client.h

(svn_client_conflict_option_set_moved_to_repos_relpath): Accept a client


* subversion/libsvn_client/conflicts.c

(svn_client_conflict_option_set_moved_to_repos_relpath): Update the

option description, since the target path in the description could have


* subversion/svn/conflict-callbacks.c

(handle_tree_conflict): Pass the context when calling the

svn_client_conflict_option_set_moved_to_repos_relpath() function.

  1. … 2 more files in changeset.
* subversion/svn/conflict-callbacks.c

(handle_tree_conflict): Update conflict description if the user chooses

an alternative move target path.

Fix compiler warnings.

* subversion/libsvn_client/conflicts.c (map_deleted_path_to_move):

Use the correct type of local variable to avoid narrowing warnings.

* subversion/svn/conflict-callbacks.c



build_tree_conflict_options): Likewise.

(prompt_move_target_path): Check returned index range and cast it

to the target type to avoid a narrowing warning.

  1. … 1 more file in changeset.
* subversion/svn/conflict-callbacks.c

(build_tree_conflict_options): Assign dynamic option codes to unknown

conflict options. This allows the 'svn' client to work against a newer

client library which offers additional conflict options, without having

to modify 'svn' client code.

In practice, we will likely update the 'svn' client with new option codes

at the same time as libsvn_client. But this is not a requirement of the

API and doing dynamic assignment in 'svn' sets a good example which I

hope third party clients will follow.

* subversion/svn/conflict-callbacks.c

(find_option_by_builtin): Fix docstring.

Follow-up to 1779687: Fix postponing conflicts.

* subversion/svn/conflict-callbacks.c

(svn_cl__resolve_conflict): Don't mark conflicts resolved if the user

wants to postpone them. Silly bug.

Reintroduce the svn_client_conflict_walk() API.

This new implementation is based on the conflict walk we implemented in

the 'svn' command line client. The command line client now relies on the

client library to walk conflicts in the working copy.

This avoids forcing other clients to reimplement the status walk logic which

is rather complex since it needs to handle new tree conflicts which may appear

when another tree conflict gets resolved. It should make the transtion to the

new conflict API easier for third party clients since the new resolver can now

be invoked in a similar way to the old libsvn_wc conflict handler.

Suggested by: ivan

(during the October 2016 hackathon in Berlin)

* subversion/include/svn_client.h

(svn_client_conflict_walk_func_t, svn_client_conflict_walk): Declare.

* subversion/libsvn_client/conflicts.c

(conflict_status_walker_baton, tree_conflict_collector,

handle_tree_conflict_resolution_failure, conflict_status_walker,

svn_client_conflict_walk): New implementation of a conflict status walker.

Based on, and very similar to, code from svn/resolve-cmd.c.

* subversion/svn/cl.h,


(svn_cl__resolve_conflict): Remove now unused output paramer 'resolved',

and redundant parameter config (ctx->config can be used instead).

* subversion/svn/resolve-cmd.c

(conflict_status_walker_baton): Replace with...

(conflict_walker_baton): ... this, which contains only a subset of the fields.

(tree_conflict_collector, handle_tree_conflict_resolution_failure,

conflict_status_walker, walk_conflicts): Remove.

(conflict_walker): A callback for the new conflict walker.

(svn_cl__walk_conflicts): Use the new conflict walker provided by the

libsvn_client library instead of the previous inline implementation.

  1. … 4 more files in changeset.
Make 'svn resolve' print a warning when no useful option can be offered

for a tree conflict, and point users at 'svn help resolve'.

* subversion/svn/conflict-callbacks.c

(build_tree_conflict_options): New output param which indicates whether

any useful resolution options exist.

(handle_tree_conflict): Print a message if no useful options exist.

Remove two hacks from the conflict resolver API that were added to

allow handling --accept=mine-conflict | working for tree conflicts

and --accept=working for binary text conflicts.

This patch makes the command-line client fully responsible for choosing

the appropriate conflict option id, and keeps the various new APIs

such as svn_client_conflict_text_resolve_by_id() simple and doing

just what they were told to do.

Discussed in

* subversion/libsvn_client/conflicts.c


svn_client_conflict_tree_resolve_by_id): Remove hacks from these


* subversion/svn/conflict-callbacks.c

(resolve_conflict_by_accept_option): Inline parts of this function that

handle svn_cl__accept_edit and svn_cl__accept_launch ...

(svn_cl__resolve_conflict): Accept svn_cl__accept_t by value,

drop the option id argument. Pick the appropriate option id based on

the passed-in svn_cl__accept_t argument. Prompt the user if there is

no option or if the option did not apply.

* subversion/svn/resolve-cmd.c

(svn_cl__resolve): Handle unsupported --accept [--non-interactive] cases

in this function.

(svn_cl__walk_conflicts): Remove the is_resolve_cmd argument. Don't

map the --accept option to option id here, as we will do it in the

svn_cl__resolve_conflict() function. Adjust calls to walk_conflicts()

and svn_cl__resolve_conflict().

(walk_conflicts): Remove option_id argument, accept svn_cl__accept_t

by value.

(conflict_status_walker): Adjust call to svn_cl__resolve_conflict().

(conflict_status_walker_baton): Remove option_id field, store

accept_which field by value.

* subversion/svn/merge-cmd.c

(svn_cl__merge): Adjust call to svn_cl__walk_conflicts().

* subversion/svn/switch-cmd.c

(svn_cl__switch): Adjust call to svn_cl__walk_conflicts().

* subversion/svn/update-cmd.c

(svn_cl__update): Adjust call to svn_cl__walk_conflicts().

* subversion/svn/cl.h

(svn_cl__resolve_conflict, svn_cl__walk_conflicts): Update declarations.

  1. … 6 more files in changeset.
Uppercase client-specific resolve option labels.

* subversion/svn/conflict-callbacks.c:




extra_resolver_options_tree): upper-case labels.

Patch by: Patrick Steinhardt <>

Fix svn resolve --accept=working not working on binary conflicts by retrying

to find a resolution option for the semantically corresponding

svn_client_conflict_option_working_text option.

Additionally, enable the mf option for binary conflicts, so to have the

option displayed in the client.

* subversion/libsvn_client/conflicts.c

(svn_client_conflict_text_get_resolution_options): return the more


svn_client_conflict_option_working_text to resolve binary conflicts.

(svn_client_conflict_text_resolve_by_id): retry determining resolution

option with svn_client_conflict_option_working_text.

* subversion/svn/conflict-callbacks.c

(handle_text_conflict): add "mf" to the list of allowed resolutions for

binary conflicts.

* subversion/tests/cmdline/

(automatic_binary_conflict_resolution): remove XFail marker

Approved by: stsp

  1. … 2 more files in changeset.
Rename svn_client_conflict_option_describe() to


* subversion/include/svn_client.h

* subversion/libsvn_client/conflicts.c

(svn_client_conflict_option_describe): Rename to


* subversion/svn/conflict-callbacks.c

(find_option_by_builtin): Adapt callers.

  1. … 2 more files in changeset.
Simplify svn_client_conflict_option_describe() API to match


* subversion/include/svn_client.h

* subversion/libsvn_client/conflicts.c

(svn_client_conflict_option_describe): Drop svn_error_t and scratch_pool.

* subversion/svn/conflict-callbacks.c

(find_option_by_builtin): Adapt callers.

  1. … 2 more files in changeset.