用svnsync 同步备份任意两个svn 版本库

news/2024/7/24 11:44:07 标签: 操作系统, python, shell

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

 

用svnsync  同步备份任意两个svn 版本库    20100706  


如用svnsync  同步备份两台机器的svn 。

要同步的项目名称:svn_repos  

svn  版本库1 。4 以上
源目录:            svn://192.168.108.254/svn_repos    
同步目标目录:      http://    目标IP:8080/svn/svn_repos/    

方法:

1. 如果目标目录 存在相同的项目,请先清除,重新建立空项目
    svnadmin create svn_repos    


2.  在 192.168.120.190   (   目标目录 )->   cendyn  目录下hooks 目录下,建立
pre_revprop-change.bat  全部内容只有一行:exit 0
如果用拷贝同目录下的pre_revprop-change.tmpl  则必须删除最后三行的内容或替换为只有一行:exit 0
不然下面初始化同步的时候,将停顿.  


3.  执行 初始化(在目标目录 )
    svnsync init http://  目标IP:8080/svn/svn_repos/ svn://192.168.108.254/svn_repos    

即svnsync init  目标库 源库
将向你询问登录目标库和源库的用户名和密码,建议为两个库设置相同的用户名及相同的密码正确后,显示
Copied properties for revision 0.  

4.  执行同步(目标目录 )
svnsync sync http://  目标IP:8080/svn/svn_repos/    

5. 更新同步
windows  下:  

在源库的hooks 下面,添加post-commit  脚本
可拷贝post- commit.tmpl->post- commit.bat  

set SVN_HOME="C:\Install Files\svnserver\bin"
%SVN_HOME%\svnsync sync --non-interactive    
http://192.168.120.190:8080/svn/cendyn   --username R00130 --password 123

linux 下:  

在源库的hooks 下面,添加post-commit  脚本

可拷贝post-commit.tmpl  即   

cp post-commit.tmpl post-commit

然后

把 post-commit  中,最后两行替换为   

svnsync sync  --non-interactive http://192.168.108.187:8080/svn/svn_repos/ --username edison --password edison

即提交更新后,即执行同步命令,不进行交互

把post-commit  设为755 权限。   

ps :

如果post-commit 脚本出错,或者无可执行权限,在提交更新时会报错

 

错误处理 :
在源端 ,  同步用的帐号需要有读权限 ,  在目的端同步帐号需要读写权限 .  权限分配合理后 , 基本上就不会出现其他错误 .

如果出现以下列出的之外的错误 ,  请先检查一下 svn  服务是否可正常使用 .
比较常见的错误是 :
# svnsync initialize DEST_URI SRC_URI --username cax  --password password_for_cax
svnsync: DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent
svnsync: At least one property change failed; repository is unchanged

这是由于系统中没有  pre-revprop-change  钩子脚本导致的 ,  该文件在版本库的  ~/hooks/  下 ,  只需拷贝一份即可 .
cp -pf hooks/pre-revprop-change.tmpl hooks/pre-revprop-change

如果是 windows 系统 ,  还需要清空  pre-revprop-change  的内容 ,  并添加后缀为  pre-revprop-change.bat
在批处理文件中 , Linux 下  shell  中注释符  #   不能被  batch  正确解释也会重复出现该错误 .


转载于:https://my.oschina.net/u/554660/blog/282351


http://www.niftyadmin.cn/n/1503498.html

相关文章

Java基础快速浏览

Java基础快速浏览 基本结构 /*** 可以用来自动创建文档的注释*/ public class Hello {public static void main(String[] args) {// 向屏幕输出文本:System.out.println("Hello, world!");/* 多行注释开始注释内容注释结束 */} } // class定义结束public修饰符&…

linux下时间的同步

echo "unset MAILCHECK">> /etc/profile . /etc/profile source /etc/profile 时间同步: Date –R 比我的时间快12个小时 Tzselect 先设置地区 并且设置环境变量 echo "export TZAsia/Shanghai" >>/etc/profile source /etc/profil…

微软职位内部推荐-Sr DEV

微软近期Open的职位:Group: Search Technology Center Asia (STCA)/Data Platform teamTitle: Senior Software Development EngineerLocation: Beijing, ChinaThe R&D of Data Platform at Search Technology Center Asia aims to build a unified data platform encompas…

【翻译】为什么Java中的String不可变

笔主前言: 众所周知,String是Java的JDK中最重要的基础类之一,在笔主心中的地位已经等同于int、boolean等基础数据类型,是超越了一般Object引用类型的高端大气上档次的存在。 但是稍有研究的人就会发现,String对象是不可…

ACM-ICPC 2018南京赛区网络预选赛

A题&#xff1a;An Olympian Math Problem 可以发现最终的答案就是n-1 1 #include <iostream>2 #include<bits/stdc.h>3 using namespace std;4 typedef long long ll;5 int main()6 {7 int t;8 ll n;9 scanf("%d",&t); 10 while(t-…

ES6快速浏览

ES6快速浏览 let和const关键字 let 局部变量作用于块级作用域{}&#xff0c;而var是函数级作用域必须先定义后才可使用&#xff0c;而var定义的变量会先提升成undefined不可重复声明变量&#xff0c;var可 const 常量&#xff0c;不可修改块级作用域对象常量&#xff0c;只…

中山大学校队选拔赛第一章题4【简单数迷Simple Kakuro】-------2015年1月28日

一&#xff1a;题意描述 本题就是给定一个迷宫&#xff0c;其中第一行和第一列都给定了数值。现在我们的任务就是需要把剩余的空格用1-9的数字把它填满&#xff0c;并且每行每列数值之和需要和行列标定的值相等。问最后是否可行&#xff0c;如果有多种方案需要输出一种方案。 二…

【mysql】采坑合集

bugOperation not allowed when innodb_forced_recovery &#xff1e; 0Operation not allowed when innodb_forced_recovery &#xff1e; 0 MySQL在转储文件或者导入数据的过程中&#xff0c;出现中断、失败或者异常&#xff0c;造成数据无法回滚&#xff0c;可以通过innodb_…