Friday, March 5, 2010

svnsync vs svndumpfilter

If you ever want to use svndumpfilter one day, you should now that it simply does not work. Search google for svndumpfilter2, svndumpfilter3 and svndumpfilter4.

You always end up with memory issue, or simply crazy errors ! Instead a better (supported) solution is to use svnsync. However how do you filter out directory ? Well according to:

In Subversion 1.5, svnsync grew the ability to also mirror a subset of a repository rather than the whole thing. The process of setting up and maintaining such a mirror is exactly the same as when mirroring a whole repository, except that instead of specifying the source repository's root URL when running svnsync init, you specify the URL of some subdirectory within that repository. Synchronization to that mirror will now copy only the bits that changed under that source repository subdirectory. There are some limitations to this support, though. First, you can't mirror multiple disjoint subdirectories of the source repository into a single mirror repository—you'd need to instead mirror some parent directory that is common to both. Second, the filtering logic is entirely path-based, so if the subdirectory you are mirroring was renamed at some point in the past, your mirror would contain only the revisions since the directory appeared at the URL you specified. And likewise, if the source subdirectory is renamed in the future, your synchronization processes will stop mirroring data at the point that the source URL you specified is no longer valid.

However what should you do when your source subversion server is 1.4.2 ? Well simple do it twice:

svnsync https://SERVER-SVN1.4-ROOT-URL file://FILE-COPY-ROOT-URL

And now you have at hand a brand new suberversion server 1.5 !

svnsync file://FILE-COPY-ROOT-URL file://FILE-COPY-ROOT-URL/MySub/Directory

Cheers !

No comments: