Search code examples
svnmerge

Merge folder deletions with SVN sparse checkout causes "invalid status for updating properties" error


I'm doing a sparse checkout in SVN, to do a merge for a small change that includes a folder deletion which is causing me headaches.

Here is an example:

svn co https://bigrepo.company.com/ .
mkdir source_branch
mkdir source_branch/proc
mkdir source_branch/proc/new_folder
touch source_branch/proc/new_folder/new_thing
svn add . --force
svn ci
svn cp source_branch/ target_branch/
svn ci

Then create a revision in my source branch I want to merge

svn del source_branch/proc/new_folder
svn ci

and then when merging it to another branch (with a sparse checkout):

svn co https://bigrepo.company.com/target_branch --depth empty .
svn up --depth empty proc
svn up --depth empty proc/new_folder
svn up --depth empty proc/new_folder/new_thing
svn merge https://bigrepo.company.com/source_branch -c 1635 .

svn gives me this error

svn: E155023: Can't set properties on 'proc/new_folder/new_thing': invalid status for updating properties.

BUT if I do a full checkout like so:

svn co https://bigrepo.company.com/target_branch --depth infinity .
svn merge https://bigrepo.company.com/source_branch -c 1635 .

The merge works fine. Why doesn't this work with a sparse checkout?


I played around with updating at different levels and I'm not really sure why some work and some don't.

This doesn't work:

svn co https://bigrepo.company.com/target_branch --depth empty .
svn up --depth empty proc/
svn up --depth infinity proc/new_folder
svn merge https://bigrepo.company.com/source_branch -c 1635 .

This works:

svn co https://bigrepo.company.com/target_branch --depth empty .
svn up --depth infinity proc/
svn merge https://bigrepo.company.com/source_branch -c 1635 .

which is a little better, but still not ideal


Solution

  • http://svnbook.red-bean.com/en/1.7/svn.branchmerge.advanced.html

    Avoid merges to targets with sparse directories. Likewise, don't merge to depths other than --depth=infinity

    This may just be how SVN works; which is to say, not well when doing merges on sparsely checked out working copies.

    From what I've been able to divine, when doing a merge, SVN will add merge info to files and folders. At which level it adds merge info is based on how the working copy is built. That is to say, SVN is "smart" enough to know that if you checked out a folder with --depth empty it can only add a partial merge for that revision to the folder. If you checked out files/folders underneath that folder, it will add merge info at those level as well, it may consolidate that merge info later when SVN performs what it calls an "elide" step.

    Contrasted with a checkout at --depth infinity, SVN doesn't need to track merge info at lower levels and can effectively skip the elide step altogether for that folder tree.


    So the options are, do a full --depth infinity checkout, or stop using SVN's merge tracking and merge with --ignore-ancestry which will perform the merge correctly, but won't post mergeinfo.