Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
389 views
in Technique[技术] by (71.8m points)

ignore - How to keep SVN from updating a directory already in repository

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...