Change depth in existing SVN working copy without redownloading

后端 未结 5 876
走了就别回头了
走了就别回头了 2020-12-25 12:12

I have a working copy of an entire SVN repository, but I want to change it into a sparse working copy because of disk space issues.

One way to do this would be:

5条回答
  •  Happy的楠姐
    2020-12-25 12:43

    Nothing like reviving an old SO Question.

    I have been working with a very similar problem where I branch from trunk to create a release package but due to limitations I have to clone files which are only intended for dev.

    asset
    └── js
        └── some
            └── directories
                ├── assets
                │   ├── files ...
                ├── dev       **<------------ This folder needs to be empty**
                │   ├── apis
                │   ├── campaign
                │   ├── features
                │   ├── modules
                │   ├── main.js
                │   └── tags
                └── release
                    ├── apis
                    ├── data
                    ├── features
                    ├── modules
                    ├── main.js
                    └── tags
    

    I decided that I would exclude the dev files to remove the temptation to patch a fix in the release branch in the wrong directory.

    I do a lot of sparse checkouts to avoid large folders in trunk but have never done it retrospectively on a working copy. It seems this is pretty straight forward.

    To modify the working copy so that asset/js/some/directories/devis empty you can simply run the svn co command again on the working copy.

    In my case the following works

    svn co --depth empty ^/branches/releases/latest/asset/js/some/directories/dev \
    asset/js/some/directories/dev
    

    You are basically running a partial checkout on your pre-existing working copy and this will work at any level. In the original case you would simply run the following.

    svn co --depth immediates ^/branches/mybranch/projects projects
    svn co --depth immediates ^/branches/mybranch/project1 project1
    svn co --depth immediates ^/branches/mybranch/project2 project2
    

    For those that don't know the caret ^ is shorthand for the repository root so it works like a relative path on your repository a little like ../some/location.

    The key here is that you are not creating a new working copy to fix your problem. You are running these commands on your existing working copy and resetting the depth of your chosen directories.

提交回复
热议问题