3

I'm trying to create a read-only mirror of a SVN repository where I'm only interested in two top level branches and all their underlying subdirectories. i.e. /trunk/* /branches/reviews/*

There are several other branches under /branches that I want to ignore.

I already have svnsync working to mirror the entire repository between sites. I'm just wondering if I can svnrdump pipe into svndumpfilter using --drop-emtpy-revs to either include the two branch patterns or exclude the other branch patterns. Once I have a dump of only trunk/* and reviews/*, then I'll load it up, svnsync init it and start up the sync.

Am I on the right track or is there another method that anyone might suggest?

Thanks, Brent

  • Indeed, with `svndump` and `svndumpfilter` you can do the job. I did something similar some time ago (split a big repository into smaller repositories that contained only some directories). My repository didn't have branches, I cannot tell how/if it will work with merge commits. – axiac Nov 24 '14 at 17:58
  • 1
    [Sparse checkout](http://svnbook.red-bean.com/en/1.8/svn.advanced.sparsedirs.html) with different `--set-depth` on `svn up`? – Lazy Badger Nov 25 '14 at 14:57
  • Thanks @LazyBadger I didn't know about Spare Directories before, that's quite cool. I think that should be an answer. – Richard Neish Nov 25 '14 at 16:53

1 Answers1

0

If you are actually wanting a replicated repository and not a sparse checkout as suggested above, I have some suggestions.

First off, --drop-empty-revs and svnsync will not play nice; svnsync depends on the revision numbers being exactly the same, if not, you'll get an error like this:

svnsync: E000022: Revision being currently copied (2018), last merged
revision (2017), and destination HEAD (1234) are inconsistent; have
you committed to the destination without using svnsync?

Secondly, splitting certain directories out of a repository can be fraught with problems, usually because of files being copied from branches outside of the set you've selected, as happens in this question. A detailed description of this problem can be found here.

Another way to make a partial copy which avoids the previous problem is briefly mentioned in the SVN FAQ. This solution has worked great for me. So what you need to do is restrict access to your repository with authz, something like this (note that you have to deny access to the things you don't want replicated):

[/]
myuser = r
[/trunk]
myuser = r
[/branches/reviews]
myuser = r
[/tags]
myuser =
[/branches/other]
myuser =

Then set up and run your svnsync and anything outside of the directories you're allowed to read will not be present, meaning you'll have a lot of empty revisions, but, as I said before, that is needed to keep svnsync happy.

Hope this helps!

Community
  • 1
  • 1
trent
  • 341
  • 2
  • 8