rilpoint_mw113

Subversion

Содержание

Установка (Centos Linux 4)

Инсталляция:

yum install subversion
groupadd svn &&
useradd -c "SVN Owner" -d /home/svn -m -g svn -s /bin/false svn
mkdir /home/svn/repos
chown svn:svn /home/svn/repos

/etc/init.d/svn:

#!/bin/bash
#
# svnserve        Startup script for Subversion server
#
# chkconfig: - 85 15
# description: Subversion server
# processname: svnserve

# Source function library.
. /etc/rc.d/init.d/functions

case "$1" in
        start)
                echo "Starting Subversion..."
                daemon --user="svn" /usr/bin/svnserve -d -r /home/svn/repos
                ;; 

        stop)
                echo "Stopping Subversion..."
                killproc /usr/bin/svnserve
                ;;

        restart)
                $0 stop
                sleep 1
                $0 start
                ;;

        status)
                status /usr/bin/svnserve
                ;;

        *)
                echo "Usage: $0 {start|stop|restart|status}"
                exit 1
                ;;
esac

# End $rc_base/init.d/svn</code>

Добавляем в автозагрузку:

chkconfig --level 35 svn on

Запускаем:

service svn start

Создание SVN репозитория

Создаем новый репозитарий:

svnadmin create /home/svn/repos/test
chown -R svn:svn /home/svn/repos/test

Определяем права доступа к созданному репозиторию

/home/svn/repos/test/conf/svnserve.conf:

[general]
anon-access = none
auth-access = write
# на каждый отдел создается свой svn-auth
password-db = /home/svn/svn-auth
realm = test repository

/home/svn/svn-auth:

[users]
admin=admin_pass
vasya=vasya_pass

Работа с репозиторием

Выкатывание с сервера (создание локальной копии):

svn checkout svn://servername/test/

Актуализация (обновление локальной копии):

svn update svn://servername/test/

Подтверждение изменений (обновление серверной копии):

svn add program.tgz
svn commit svn://servername/test/ -m "added new verson of program"

Настройка доступов

users (all r/o, proger r/w)

[/]
proger = rw

[/]
* = r
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ().

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

Отмена ревизии

Чтобы отменить ревизию в репозитории, надо сделать дамп, стереть оттуда последние ревизии и загрузить дамп обратно.

svnadmin dump REPO_PATH > w

Сотрем последние ревизии

vi w

Сотрем репозиторий, сохранив опции

Cоздадим новый и зальем туда дамп

svnadmin create REPO_PATH
cat w | svnadmin load REPO_PATH

Примечание. Возможно, есть более простой способ

svn: Unrecognized URL scheme for

[zarex@host ~]$ svn --version
svn, version 1.6.1 (r37116)
   compiled May 21 2009, 16:30:48

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme

Восстановление после сбоя БД

svnadmin recover PATH # непосредственно восстановление
chown -R svn:svn PATH # восстанавливаем права

Внешние ссылки

Наиболее полная документация по Subversion:

http://svnbook.red-bean.com/

FAQ по Subversion

http://subversion.tigris.org/faq.html

http://queens.db.toronto.edu/~nilesh/linux/subversion-howto/

Источник — «http://www.openwiki.ru/wiki/Subversion»