svn checkout depth

与世无争的帅哥 提交于 2019-12-04 07:40:19

问题


I have an SVN project with tree like this:

/project
    /dir1
        /subdir1
           -file1
           -file2
            .....
        -file1
        -file2
        .....
    /dir2
        -file1
        -file2
        .....
    /dir3
        /subdir1
           -file1
           -file2
            .....
        /subdir2
           -file1
           -file2
            .....
        /subdir3
           -file1
           -file2
            .....
        /subdir4
           -file1
           -file2
            .....
    /dir4
        -file1
        -file2
        .....
-file1
-file2

I need to checkout

  • all files from /project
  • full /dir1
  • full /dir2
  • full /dir4
  • From /dir3 I need only /subdir1 and /subdir3

Can I checkout these files/folders using svn commandline with some kind of depth? If so how can I do it? Can I add subdir2 to dir3 after a checkout? How can I update working copy created this way? Will normal "svn up" command update only these folders or full update of project will be performed?


回答1:


What you need is called sparse checkout.

In your case you can:

svn co --depth files file:///project project
cd project
svn up --set-depth infinity dir1 dir2 dir4
svn up --set-depth empty dir3
svn up --set-depth infinity dir3/subdir1 dir3/subdir3

Can I add subdir2 to dir3 after a checkout?

Yes: svn up --set-depth infinity dir3/subdir2

How can I update working copy created this way? Will normal "svn up" command update only these folders or full update of project will be performed?

Yes, svn up will update only these files and folders, that is update depth will be preserved.




回答2:


1) svn up --set-depth empty file/folder path

// it will delete the file from your system

2) svn up --set-depth infinity file/folder path

// it will regenerated the file from svn server to your local system



来源:https://stackoverflow.com/questions/11650156/svn-checkout-depth

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!