Faking the depth of an SVN checkout

For some reason my local copy of an SVN repo stopped recognising the parent directory as a working copy. I would normally fix this by checking out again into another folder and overwriting the new working copy with my changed files. I would then do a commit from the new folder.

I want to avoid doing that on this occasion because the repo contains thousands of large images and checking out takes a long time. So what I want to do is check out non-fully recursively into a new directory, copy my existing files into the new directory, and then check the whole thing in.

The trouble is that SVN knows I only checked out a few files. Is there a way I can fake it and make SVN think I just did a full checkout? (eg a way I can get hold of just the .svn folder for a complete checkout without actually checking everything out)


A sparse checkout of your repository in a new location should do what you want (http://svnbook.red-bean.com/en/1.5/svn.advanced.sparsedirs.html). If I understand you correctly, you will want to do an empty checkout of the topmost directory and then do an 'svn up' on just the artifacts you want, setting the depth as you go.

For example, let's say I have a top level folder called 'foo' and it contains two folders, 'bar' and 'zoog'.

/foo
  /bar
    -the files I want
  /zoog
    -the universe

The folder 'zoog' has a large number of files that I don't care about at the moment but I want to be able to work with 'bar'. I would do the following:

svn co --depth empty file:///var/svn/repos/FooRepo foo
cd foo
svn up --set-depth infinity bar

Now 'svn up' shows everything is up to date and I can make changes in 'foo' and 'bar' and commit them as if I had also checked out 'zoog' without all of the overhead.

(The arguments to --set-depth in svn update are exclude, empty, files, immediates, and infinity)


You most likely damaged or deleted the hidden .svn folder inside every checkout.

Use the command line to do svn co svn://your/svn/repository --depth immediates elsewhere and restore the .svn folder from there. Then you will need to go through a lot of svn update . and svn cleanup sequences to re- associate the subfolders with the parent folder.


First backup your full working copy. Then update to last revision your working copy. your last revision has root folder. SVN will try to write that folder again. Then a tree conflict will show. Then run cleanup and commit it again.

链接地址: http://www.djcxy.com/p/55242.html

上一篇: 我怎样才能按比例设置这个jQuery动画的持续时间?

下一篇: 伪装SVN结帐的深度