开发者

How to get SVN to ignore a directory inside an externals definition

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 repositor开发者_开发知识库y 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?


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.


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜