How to get SVN to ignore a directory inside an externals definition
Asked Answered
G

4

12

I'm using subversion to host my own repository for a WordPress installation. I've got it set up so that all of the core WordPress files are in their own directory (called wordpress) and set up to use svn:externals to link to the WordPress repository. I then have my own copy of the wp-content directory (located outside of the wordpress directory) which does not use svn:externals. This is all working fine.

When I update my repository, the WordPress core gets updated. Since the WordPress repository contains it's own wp-content directory, it also updates that directory. So my file structure ends up looking something like this:

/
--/wordpress/   (wordpress repo)
-----/wp-admin/
-----/wp-content/
--/wp-content/  (my local repo)

I end up having two separate versions of the wp-content folder (one from my repo and one from the WordPress repo). I don't want the one from the WordPress repo (or at least not in that location). Is there a way for me to set svn to ignore the wordpress/wp-content directory while still using externals definition?

Gath answered 21/1, 2010 at 20:58 Comment(3)
I don't know, but I guess you could try setting a svn:ignore property into the root directory and seeing what happens. It's likely that it won't work, though.Habitforming
That doesn't seem to work. As soon as I update my working copy it goes and downloads the wp-content files again.Gath
I'm slightly late to this - but I don't think that its an issue having the duplicated wp-content. Assuming that you've defined the WP_CONTENT_DIR to something like define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/wp-content' ); then WordPress will ignore its own wp-content directory.Intermarry
C
11

What you’re really asking is, “Can you specify --depth for svn:externals” and the answer is no. Externals currently are fully recursive on the specified directory.

Issue 3216 requests this functionality, but it doesn’t look like it’s coming any time soon.

Chewning answered 22/1, 2010 at 1:39 Comment(1)
Hmm, ok. I figured you couldn't do what I wanted but I was hoping I had missed something. Thanks.Gath
T
2

You could make separate externals to each subfolder within the referenced repository. So if your external is to a repo with projects A, B, and C and you only want A and B then you can make two separate external reference to the subfolders for A and B individually.

Currently I'm doing this with a project but you can run into problems if you are actually making edits to the externals and committing them since changes in two separate externals cannot be committed atomicly. This problem exists even if the two externals actually point to the same repository which makes sense but is important to note when using this technique.

Also if you are responsible for the second repository, one option is also to tuck testing, documentation and other related folders into a yet another separate repository with externals to the source code in order to separate them from the main code repository. This way these folders won't be pulled in when making an external reference because of code dependencies.

Theona answered 5/4, 2010 at 2:20 Comment(0)
C
0

You can do this with sparse directories (also known as shallow checkouts). I am not 100% sure it works when using externals, but I don't see why it wouldn't.

Cyb answered 21/1, 2010 at 21:1 Comment(1)
I don't think that sparse directories is what I want. I want to be able to set my svn repo to always ignore this particular file (within the external definition) and then forget about it. I don't want to have to type in extra stuff every time I make changes.Gath
S
-1

What happens if you try to remove the local wp-content directory, but do it through SVN? ie.

svn rm /wordpress/wp-content

This way SVN should remember your changes, and I assume you aren't pushing stuff to the Wordpress repo, so you don't need to worry about accidentally commiting it.

Slumgullion answered 6/7, 2010 at 21:38 Comment(1)
this doesn't work. svn up will bring back the removed folderSprue

© 2022 - 2024 — McMap. All rights reserved.