SVN: Can you remove directories from a local checkout only (not from the repository)?

后端 未结 5 1891
栀梦
栀梦 2021-01-31 01:57

Assume that you have a directory under subversion control, that contains some files and tons of subdirectories, like that:

file1.txt
file2.txt
file3.txt
dir1/
di         


        
相关标签:
5条回答
  • 2021-01-31 02:35

    For anyone who comes across this later, and uses TortoiseSVN, here is how to do the same thing...

    1. Right-click on the folder that you no longer want checked out (this is the folder you want to exclude)
    2. From the context menu, choose "TortoiseSVN > Update to Revision..."
    3. In the window that pops up, set the "Update Depth" dropdown box to "Exclude"
    4. Click "OK". SVN will automatically remove that directory from your drive now.

    (Note: This was done with TortoiseSVN 1.7.5, and may vary for other versions.)

    0 讨论(0)
  • 2021-01-31 02:35

    You can try this trick involving a local repository and svn:externals declarations.

    Haven't tried it myself, though.

    0 讨论(0)
  • 2021-01-31 02:49

    What I'm trying to do cannot be done with Subversion 1.4 or Subversion 1.5; Period.
    No work around exists, that's just the way it is.

    It can be done with Subversion 1.6, though.

    Unlike SVN 1.5, SVN 1.6 can reduce the depth on a directory

    svn up --set-depth exclude dir2
    

    is the solution. It sets the depth for dir2 to zero and it will immediately vanish from the checkout and no update will bring it back, unless you explicitly set the depth of this directory to a value again (or just do an update on it without depth option, since not giving any depth always means infinity, unless you use non-recursive, which means "files").

    TIP:
    Actually SVN 1.6 cannot really reduce the depth the same way it can increase it. You can increase it from any level to any higher level. You can only reduce it to "exclude" (the lowest level of all). If you want to reduce from "infinity" (highest) to "files" (somewhere in the middle), you must first reduce it to "exclude" (causing the directory to vanish) and then increase it back again to "files". This is a bit of a hack, but it works just nice.

    0 讨论(0)
  • 2021-01-31 02:52

    Update: I'm running SVN 1.6.11 and I was able to de-telescope using svn up --set-depth empty dir rather that having to exclude the directory.

    0 讨论(0)
  • 2021-01-31 02:53

    With svn 1.6, --set-depth is the answer.

    With svn < 1.6, you can get sparse checkouts by abusing svn switch: Create an empty directory somewhere in your repository, and switch the subdirectories you don't need right now to point to that instead of their "real" URL.

    0 讨论(0)
提交回复
热议问题