Mergeinfo loss after svn copy --no-recursive followed by svn move in Subversion 1.9+
0 reputation · 29 Jun 2024, 04:24 UTC
0 reputation · 29 Jun 2024, 04:24 UTC
Goal: preserve accurate svn:mergeinfo when reorganizing a branch by first copying a subtree with svn copy --no-recursive and then moving the copied subtree with svn move.
Uncertainty: the --no-recursive flag may prevent mergeinfo from being set on the new copy, and the subsequent move might not restore the original merge tracking data, potentially causing duplicate revisions or spurious conflicts during later merges.
Questions:
29275 reputation · 29 Jun 2024, 14:26 UTC
Yes. svn copy --no-recursive copies the properties of the node you are creating, including svn:mergeinfo if it is explicitly set on that source directory. --no-recursive controls depth of descendants, not property copying.
svn move is a copy followed by a delete. It preserves the properties of the node it moves, including any svn:mergeinfo that the intermediate copy already has. It does not recover mergeinfo that was never present on the intermediate node.
svn:mergeinfo is copied with the node being created by svn copy. The property is not generated or synthesized.--no-recursive / --depth empty means the target directory entry is created and its own properties are copied, but no children are copied. Mergeinfo on children is not copied because the children are not copied.svn move preserves the property set of the source node at move time. If mergeinfo is missing on the intermediate node after the copy, the move will not add it back.The loss you are seeing is usually not caused by --no-recursive on the directory node itself. Common causes:
svn:mergeinfo on it, only inherited mergeinfo from an ancestor. An explicit copy does not copy inherited mergeinfo.--no-recursive creates an empty directory. Children and their explicit mergeinfo are not copied.These are likely explanations, not verified for your repo. Behavior can differ slightly between URL-to-URL and working-copy-to-URL operations.
svn propget svn:mergeinfo ^/path/to/source
svn copy --no-recursive:
svn propget svn:mergeinfo ^/path/to/intermediate-copy
svn move:
svn propget svn:mergeinfo ^/path/to/final-destination
If step 2 shows the same explicit mergeinfo as step 1, the copy preserved it and the move will keep it.
If you need the full subtree merge tracking, do not use --no-recursive for the copy. Use a recursive copy or move directly:
svn copy ^/branches/old/subtree ^/branches/new/subtree -m "reorg"
# or
svn move ^/branches/old/subtree ^/branches/new/subtree -m "reorg"
Avoid manual svn propset svn:mergeinfo to “fix” it; manual edits create mergeinfo noise and future merge conflicts.
One diagnostic that changes the recommendation: is the svn:mergeinfo you expect explicitly set on the source directory node, or is it only inherited from a parent? If it is inherited only, a copy will not carry it and you will need a recursive copy or an explicit mergeinfo strategy.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.