Posts Tagged: subversion


25
四 09

使用基于Apache的 subversion/svn 管理代码

到版本1.5.6,subversion提供的svnserve搭建的SVN服务器,使用的仍然是名文密码文件。

为了使用加密的密码文件,需要借助于Apache,使用subversion的mod_dav_svnmod_authz_svn.so,使用基于Apache的认证机制。

假如使用发行版的Apache,那么一般发行版都带了相应的svn模块mod_dav_svn(CentOS)、libapache2-svn(Debian/Ubantu),直接安装即可。

下面主要介绍

源代码安装mod_dav_svn:

下载subversion的源代码:http://subversion.tigris.org/

与Apaceh相关的两个编译选择:

–with-apxs[=FILE]      Build shared Apache modules. FILE is the optional pathname to the Apache apxs tool; defaults to “apxs”.
–with-apache-libexecdir[=PATH] Install Apache modules to PATH instead of Apache’s configured modules directory; PATH “no” or –without-apache-libexecdir means install to LIBEXECDIR.

一般指定使用 –with-apxs=[apxs的绝对路径]来编译。默认会安装两个模块到Apache的modules目录内,分别mod_authz_svn.so、mod_dav_svn.so。

配置Apache:

1. 加载SVN依赖的模块

LoadModule dav_module             modules/mod_dav.so
LoadModule dav_fs_module         modules/mod_dav_fs.so
LoadModule dav_svn_module       modules/mod_dav_svn.so
LoadModule authz_svn_module    modules/mod_authz_svn.so

2. 建立svn仓库

svnadmin create /srv/_svndata/isystem
svnadmin create /srv/_svndata/iconfig

3. 配置apache对svn仓库的管理
# 注意,/svn目录不能在你的DocumentRoot目录下。
<Location /svn>
# 启用SVN
DAV svn
# 设置SVN仓库的路径
# SVNPath /srv/_svndata/isystem
# 假如在一个目录下有多个仓库,那么可以使用SVNParentPath来指定多仓库的根目录
# 也可以使用SVNPath来进行单独的设置
SVNParentPath /srv/_svndata

AuthType Basic
AuthName “Subversion Repository”
AuthUserFile /etc/apache2/dav_svn.passwd

# 设置SVN的权限控制
AuthzSVNAccessFile /etc/apache2/dav_svn.authz

<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>

</Location>

4. 添加SVN访问账号

htpasswd /etc/apache2/dav_svn.passwd  caoyuwei

编辑:/etc/apache2/dav_svn.authz

[groups]
admin = caoyuwei
[/]
@admin = rw
[isystem:/]
@admin= rw
[iconfig:/]
@admin=rw


28
三 09

分布式版本控制

Git: http://git-scm.com/

Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Every Git clone is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Branching and merging are fast and easy to do.

Git is used for version control of files, much like tools such as Mercurial, Bazaar, Subversion, CVS, Perforce, and Visual SourceSafe.

Git在苹果系统上非常流行。

Mercurial : http://www.selenic.com/mercurial/wiki/
http://mercurial.selenic.com/

A fast, lightweight Source Control Management system designed for efficient handling of very large distributed projects.

Bazaar : http://bazaar-vcs.org/

Bazaar is a distributed version control system that Just Works. While other systems require you to adapt to their model of working, Bazaar adapts to the way you want to work, and you can try it out in five minutes.

MySQL, Mailman, Launchpad, and the Linux Foundation are among the many projects and organizations using Bazaar.

Bazaar runs on Windows, GNU/Linux, UNIX and Mac OS, and requires only Python 2.4. If you can run Python, you can run Bazaar! It is an official GNU project, licensed under the GPLv2 or later, at your option.

Perforce  : http://www.perforce.com/perforce/products.html

The Perforce Software Configuration Management System features comprehensive SCM capabilities built around a scalable client/server architecture. Users can access the Perforce Server through a range of Perforce client software. Perforce can be deployed quickly and easily, and requires minimal administration even for large or distributed sites

参考:

http://en.wikipedia.org/wiki/Distributed_revision_control

为什么我们要放弃Subversion : http://www.infoq.com/cn/articles/thoughtworks-practice-partiv


28
五 08

SVN服务端数据如何备份

貌似假如系统版本相同或相似或相当,可直接通过备份目录来备份、迁移SVN服务器数据。

不过在CentOS的发行说明里看到如下的方法,应该是更通用的。

Subversion
在 红帽企业 Linux 5 中,Subversion 版本控制系统是与 Berkeley DB 4.3 相关联的。如果从 红帽企业 Linux 4 进行了升级,而其中有使用 Berkeley DB 后端 “BDB”(而不是纯基于文件系统的 “FSFS” 后端)创建的 Subversion 存储库(repository),您需要注意存储库是否可以在升级后被访问。这个过程必须在 红帽企业 Linux 4 系统上执行,并应该在升级到 红帽企业 Linux 5 前 进行:

关闭所有运行的进程,并确认没有程序在访问存储库(如 httpd、svnserve 或本地用户在直接访问)。

使用下面的命令对存储库进行备份:

svnadmin dump /path/to/repository | gzip > repository-backup.gz

在存储库中运行 svnadmin load 恢复命令:

gzip -d repository-backup.gz

svnadmin create /path/to/new_repository

svnadmin load /path/to/new_repository  < repository-backup

删除存储库中无用的日志文件:

svnadmin list-unused-dblogs /path/to/repository | xargs rm -vf

删除存储库中所有剩余的共享内存文件:

rm -f /path/to/repository/db/__db.0*