Server
UUID 存放在 REPOS/db/uuid

svnadmin setuuid REPOS_PATH [NEW_UUID]

Client
UUID 存放在每个 .svn/entries 文件内

sed -i “s/[OLD_UUID]/[NEW_UUID]/g” `grep [OLD_UUID] -rl /work/copy/path`
sed -i “s/b0927087-b325-4693-852c-0e4d9717ffc9/bf5bc82d-b9e2-49f5-a083-18a8b02e6a55/g” `grep b0927087-b325-4693-852c-0e4d9717ffc9 -rl /home/onoboss/td_chs`

[toc]

源服务器:http://192.168.1.81/svn
目标服务器:http://www.onoboss.com/svn

目标服务器

建立同名版本库

[shell]cd /var/lib/svn
svnadmin create chs
chown -R www-data:www-data chs[/shell]

配置hook/pre-revprop-change

[shell]
cd /var/lib/svn/chs/hooks/
vi pre-revprop-change #输入文件内容
chmod a+x pre-revprop-change #执行权限
[/shell]

pre-revprop-change文件内容:

[shell]
#!/bin/sh
exit 0;
[/shell]

同步服务器

初始任务

[shell]
#svnsync init [目标服务器] [源服务器]
svnsync init http://www.onoboss.com/svn/chs http://192.168.1.81/svn/chs
[/shell]

执行同步

[shell]
#svnsync sync [目标服务器]
svnsync sync http://www.onoboss.com/svn/chs
[/shell]

FAQ

  1. svnsync: DAV request failed; it’s possible that the repository’s pre-revprop-cha
    nge hook either failed or is non-existent
    svnsync: At least one property change failed; repository is unchanged
    svnsync: Error setting propertysync-lock‘:
    could not remove a property
    答:目标服务器未设置
    hook/pre-revprop-change,或者目录权限未更改为www-data。
  2. 中断同步进程,再次同步,出现:Failed to get lock on destination repos, currently held by ‘wonder:83edc72d-1b3c-4531-815a-b80bf58efe07’ 错误。
    答: svn propdel svn:sync-lock –revprop -r 0 http://www.onoboss.com/svn/chs
  3. svnsync: Destination HEAD (1021) is not the last merged revision (1019); have you committed to the destination without using svnsync
    答:svn propset –revprop -r0 svn:sync-last-merged-rev 1021 http://www.onoboss.com/svn/chs

参考链接

http://gregoire.org/2008/09/03/fun-with-svnsync-and-googlecode/