Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep SVN from updating a directory already in repository

Tags:

ignore

svn

This isn't, I don't think, a standard svn ignore question.

I have a repository with a huge directory in it that I don't want. Because others using the repository do, I can't just delete it from the tree. BUT, I don't want to redownload this directory every time I do a svn up. I can understand that ignore will prevent directories that I have from being uploaded to svn, but how I can I tell svn that I don't want it to redownload particular directories that are already in the repository.

What I do...

svn up
rm badDirectory

and then future svn up's redownload it. I want to prevent that.

Thanks!

edit: OK. I was hoping that SVN had a built in option that I just hadn't noticed yet. I was hoping to avoid having to "hack" around subversion's inadequacies, but the options below seem like acceptable alternatives.

edit again to address a couple of comments:

Is there particular reason why you cannot check-out that folder and keep it ? no disk space (probably not since you can check-out it) ? security reason ?

I could check out the folder. The entire svn repository is about 291 megs.. 290 of it is in this "bad" directory. Basically, some other people who have control over the repository (and therefore get to decide what goes in there) put a directory in there that really didn't need to be in there. I didn't mean for this to be a question about policy and the "proper & right" ways to use svn. I was just wondering if there was a technical solution.

Can you give a better description of the tree structure of the repository? Are there files at the same level as the bad directory, or only other directories? –

Basic structure:

repository root
 - good dir 1
    - plenty of subdirs in all of these directories
 - good dir 2
 - good dir X
 - bad dir 1
 - bad dir 2
 - bad dir X 
 - good file 1
 - good file 2
 - good file X
like image 666
Kirby Avatar asked Feb 03 '09 17:02

Kirby


People also ask

Will svn update overwrite my changes?

When you update, the contents of your working copy are updated with all of the changes that have been committed to the repository since you last updated. Subversion is pretty smart about updating and never just overwrites files that have local changes with copies from the repository.

What will happen if some versioned file or directory is removed from working copy by svn delete command?

Using svn to delete a file from your working copy deletes your local copy of the file, but it merely schedules the file to be deleted from the repository. When you commit, the file is deleted in the repository.


2 Answers

I went with the sparse checkout route similar to what Stefan mentioned. The difference is I excluded a whole directory.

Here's what I did to exclude a whole directory and all its subdirectories. Note: the unwanted directory was already on my disk so I deleted it first.

$ rm -rf unwanted-directory
$ svn checkout url/to/repo/unwanted-directory unwanted-directory --depth empty
$ cd root/of/my/tree
$ svn update
<- unwanted-directory is not acquired from the repository

For reference, we have a 'prototype' directory in our tree with a bunch of experimental code. Since I don't work in this area, I have no interest in having the 1G to sources in my multiple development trees.

like image 105
Mark Avatar answered Oct 07 '22 15:10

Mark


You can do a sparse checkout:

svn co url/to/repo mywc --depth=files

that will get you a wc with only the files in it, no subfolders. You can now get all the folders you want with

svn up url/to/repo/subfolder1 --set-depth infinity 
svn up url/to/repo/subfolder2 --set-depth infinity 
svn up url/to/repo/subfolder3 --set-depth infinity 
...
like image 33
Stefan Avatar answered Oct 07 '22 17:10

Stefan