开发者

Copy parts of an SVN repo to another

Is there any tool (or can svnsync do th开发者_如何学Gois, I don't think it can) that can copy a specific file or directory from one repo to another (both remote)?

I want to provide a read-only repo for a code library, but only a subset of that library, not the whole thing.

Thanks.


If you don't mind getting your hands dirty, you could write a little script that exports the file(s) of the private project and commits the svn-clean-files to your public project.

This way even svn diffs on the public project are possibly albeit that's not the same as the original svn history. But thats good as it's not intended.

Something like this as cron job?

#!/bin/bash

EXPDIR=$(mktemp -d /tmp/projectXXXXXX)

svn export --force svn+ssh://USERNAME@yourserver/repository/project/sub/ $EXPDIR/
svn add $EXPDIR/ svn+ssh://USERNAME@publicserver/repository/subpart/
cd $EXPDIR/
svn ci -m "update `date`" $EXPDIR/

#cleanup
rm -rf "/tmp/$EXPDIR"


I suggest you to use externals definitions as a solution. Create new repository for a read-only subset of your code library and map it to a project's subfolder.


While @initall's solution is viable, you'd loose history info etc. I'd advocate using svnsync as you suggested yourself.

Since 1.5 svnsync is capable of syncing just a sub tree of the source repo, therefore I'd say it's a cleaner solution and you would be able to have different access rights on each repo. See the repository replication section in the svn manual for details.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜