Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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? (e.g. a way I can get hold of just the .svn folder for a complete checkout without actually checking everything out)

like image 404
wheresrhys Avatar asked Oct 03 '11 15:10

wheresrhys


People also ask

What is checkout directory in svn?

Advertisements. Subversion provides the checkout command to check out a working copy from a repository. Below command will create a new directory in the current working directory with the name project_repo.

What is the difference between svn checkout and export?

They are the same except that Export doesn't include the. svn folders and Checkout does include them. Also note that an export cannot be updated.

How do I checkout a trunk in svn?

What you can do is to create a new project add define external links from it to every other projects trunks. External link works like softlink. You can then chekout everything in one step.

How do I create a working copy in TortoiseSVN?

Right click on the checked out folder, then use TortoiseSVN → Repo-Browser to bring up the repository browser. Find the sub-folder you would like to add to your working copy, then use Context Menu → Update item to revision....

How do I check the contents of my SVN repository?

We want to check the contents of our repository out into this folder. So we right-click on this folder and select ‘SVN Checkout…’ From here we’ll specify the location of the repository that we want to check our files out from. So something like…

How can SVN sparse checkout help with hard disk space?

The beauty of SVN sparse checkout is you can mix depths. For folders where I’m actively working, I can use the svn update command to change the depth setting to infinity: The ability to selectively download only parts of our repository has really helped my ever-worsening hard disk space situation!

How do I check files out from a VisualSVN repository?

So we right-click on this folder and select ‘SVN Checkout…’ From here we’ll specify the location of the repository that we want to check our files out from. So something like… If you’ve forgotten what this URL is then you can go back to the VisualSVN server app and right click to select ‘Copy URL to Clipboard’.

Is there a Git equivalent to SVN’s sparse checkout?

In Git, there is no clear analogy to SVN’s sparse checkout, but there are a couple of helpful options that will cut down the size of the repo and time to clone:


2 Answers

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)

like image 124
Matt Hulse Avatar answered Sep 21 '22 17:09

Matt Hulse


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.

like image 38
aquaherd Avatar answered Sep 21 '22 17:09

aquaherd