Reputation: 16242
I have an SVN repository on my hosted server (linux), and I need to do local work on them on my windows machine (tortoise svn installed). To simplify my question, the dir structure looks like:
root |--------sub1 |--------sub2 |--------sub3 ... |--------subN
with additional subfolders under each subX. Say I only want certain sub-subfolders of "sub1" and "sub3" under version control. But on windows, when I commit a change with tortoisesvn, I still want to be able to right click the root folder, hit commit, and have any changes that exist anywhere under root in any selected folders to be committed. The problem is, I think using ignore would be very cumbersome, since there would be so many folders to ignore, at different levels of structure.
So basically, I want to put the whole thing under version control, and then tell svn "ok, now ignore everything except X and Y". What is the easiest way to accomplish this?
Thanks, Jonah
Upvotes: 1
Views: 561
Reputation: 787
I don't think there is a way to ignore all and then not ignore specific ones. You will have to ignore the ones you want to ignore. The command I use for this is:
svn propset svn:ignore "sub1 sub2 sub3 ... subN" ./rootDir
You will have to import the directories you want in svn, then run the propset, then commit. Then add the actual ignored directories to the rootDir.
EDIT: Mistake in the above. It should be:
svn propset svn:ignore -F file.txt ./rootDir
Reason is that for multiple properties given to propset it needs them to be newline separated. See here.
So, for your problem above I would do:
ls > file.txt
Then erase the directories that you DO want version controlled, then call the svn propset from above with that file.
Upvotes: 0
Reputation: 107080
Look up the information on Sparse Directories in the Subversion Manual.
This will take a bit of work, and I don't know if TortoiseSVN supports this, but this will do what you want.
When you do your initial checkout, you should use the --depth=empty
option. This will checkout your repository, but without any folders in the working directory. Then, for each folder you do want, you need to do a svn update --set-depth infinity
. That will update that one folder and keep it updated.
$ svn co --depth=empty http://svn/repos/project/trunk myproj
checked out revision 123133
$ cd myproj
$ svn update --set-depth=infinity sub1
[yadda, yadda, yadda]
$ svn update --set-depth=infinity sub2
[yadda, yadda, yadda]
If you don't mind a bunch of empty folders in your working directory, you could use immediates
instead of empty
. That will checkout everything in that level, but not in subdirectories. You'll see folders, but they won't contain anything. Then, you can do svn update
on the folders you want. But, you if you don't use --set-depth
your subfolders will have problems updating later on.
Upvotes: 4
Reputation: 7516
With Svn, you can't add stuff under a folder that is not under version control, without adding the root dir.
svn:ignore will ignore files (from a svn status
) according to your pattern. ie. svn propset svn:ignore "*.xml" folder/
would ignore any xml files (NOT under version control) under the folder directory. So it would not help you because, once you add a file and try to ignore it, any subsequent modification would still be taken in consideration for a commit.
Because tortoise svn automaticely add any created files (using the gui), you would have to revert modifications of folders you want to exclude.
Hope this helps
Upvotes: 0
Reputation: 38328
With CVS (the predecessor to SVN) there was a .cvsIgnore file. I thinik that there is no .svnIgnore file with SVN, but I know there is svn:ignore functionality. Try a google search of ".svnIgnore file" to see if any of that fits your needs.
Upvotes: 0