When a merge creates new files or directories it does so by calling svn_client_add or svn_client_mkdir. This is wrong as it means that the new items are not related to the originals, which makes merging back to the original line painful. Since Subversion advertises its better handling of ancestor history we really need to fix this. One solution I came up with is to use svn_client_copy instead of mkdir/add. This does the right thing as far as ancestor history is concerned, but is horrible in all other respects, since the copy will fetch the file or directory tree a second time, independently from the fetch done by the merge. The copyfrom URL and revision are basically the second URL and revision passed to svn_client_copy. When dealing simply with added files it looks relatively straightforward to use svn_wc_add instead of svn_client_add, and pass the appropriate url/revision. However this will not work when adding directories. When a directory is added the directory and its contents get created in the working copy, however the contents must not be explicitly marked as copied, that is implied by the directory being marked as copied. Thus when adding a new file it should have copyfrom history only if it is not part of a copied hierarchy. This probably needs libsvn_wc support. Possibly the copyfrom stuff in svn_wc_add could be extracted into a separate function.