Aug 282012
 

동일한 계정으로 여러 명이 svn을 사용하는 경우에는 패스워드를 저장하지 않고, commit 하는 사용자별로 자신의 계정을 사용해서 commit을 하는 것이 효과적입니다.

대개 개발서버를 두고 작업을 하는 경우에 이렇게 하면 누가 commit을 하고, 해당 파일을 마지막에 수정했는지를 쉽게 파악이 가능합니다.

svn 을 shell에서 사용할때 패스워드 저장하지 않는 방법입니다.

1. 기존에 저장된 패스워드 삭제

    [smlee@localhost .subversion]$ pwd
    /home/smlee/.subversion

    [smlee@localhost .subversion]$ mv auth oldauth

2. 패스워드 저장하지 않는 옵션 변경

    [smlee@localhost .subversion]$ pwd
    /home/smlee/.subversion

    [smlee@localhost .subversion]$ grep password config
    ### Set password stores used by Subversion. They should be
    ### the order in which password stores are used.
    ### Valid password stores:
    # password-stores = gnome-keyring,kwallet
    ### Both ‘store-passwords’ and ‘store-auth-creds’ can now be
    ### Set store-passwords to ‘no’ to avoid storing passwords in the
    ### but Subversion will never save your password to disk in
    ### Note that this option only prevents saving of *new* passwords;
    ### it doesn’t invalidate existing passwords. (To do that, remove
    store-passwords = no

3. 이후에 svn commit을 하게 되면 마지막 commit 한 사용자의 패스워드를 입력해야만 commit 이 가능해짐
==> 만약 자신의 계정이 아닌 경우에는 아래와 같이 패스워드를 입력하지 않고 엔터만 입력해서 사용자 변경 가능

    [smlee@localhost public_html]$ svn commit
    인증 영역(realm): 0ee1c4cf-d430-49e6-9165-ac7844d2f91e
    ‘smlee’의 암호:
    인증 영역(realm): 0ee1c4cf-d430-49e6-9165-ac7844d2f91e
    사용자명:
Aug 282012
 

svn을 사용하면서 파일을 삭제할때 유용한 옵션 2가지를 소개합니다.

1. svn del –keep-local
svn 레파지토리에서만 파일을 제거하고, 해당 파일을 로컬에 남겨두는 기능입니다.

2. svn del –force
rm 명령어를 통해서 파일을 삭제한 경우에 svn 레파지토리에는 삭제가 안되어 있는 경우 위의 명령어를 통해서 로컬 레파지토리에 삭제를 할수 있습니다. 최종 반영은 commit 할때 반영이 됩니다.

[smlee@localhost ~]$ svn help del
delete (del, remove, rm): 파일과 디렉토리를 버전 관리 대상에서 제거합니다.
사용법: 1. delete PATH...
        2. delete URL...

  1. PATH에 있는 모든 파일, 디렉토리들을 다음 커밋에서 제거하도록
     스케쥴합니다. 커밋되지 않은 파일과 디렉토리는 --keep-local 옵션을
     사용하지 않는한 즉시 작업사본에서 제거됩니다.
     PATH가 버전 관리 대상이 아니거나 그러한 파일을 포함하는 디렉토리라면
     --force 옵션을 주어야만 삭제됩니다.

  2. URL로 지정된 아이템들은 저장소에서 즉시 삭제됩니다.


옵션:
  --force                  : 강제로 실행합니다
  -q [--quiet]             : 아무것도 출력하지 않거나, 요약 정보만 출력합니다
  --targets ARG            : ARG로 주어진 파일 내용을 옵션으로 추가합니다
  -m [--message] ARG       : 커밋 로그 메시지를 지정합니다
  -F [--file] ARG          : arg에서 로그 메시지를 읽습니다
  --force-log              : 로그 메시지의 유효성을 확인하지 않습니다
  --editor-cmd ARG         : arg를 외부 편집기로 사용합니다
  --encoding ARG           : 값을 arg에 해당하는 문자코드로 취급합니다
  --with-revprop ARG       : set revision property ARG in new revision
                             using the name[=value] format
  --keep-local             : 작업사본의 경로를 유지합니다

글로벌 옵션:
  --username ARG           : arg를 접속에 필요한 사용자 ID로 사용합니다
  --password ARG           : arg를 접속에 필요한 패스워드로 사용합니다
  --no-auth-cache          : 인증 정보를 캐시에 저장하지 않습니다
  --non-interactive        : 대화식 사용자 입력을 기다리지 않습니다
  --trust-server-cert      : accept unknown SSL server certificates without
                             prompting (but only with '--non-interactive')
  --config-dir ARG         : arg로 지정된 디렉토리에서 사용자 구성화일을 읽습니다
  --config-option ARG      : set user configuration option in the format:
                                 FILE:SECTION:OPTION=[VALUE]
                             For example:
                                 servers:global:http-library=serf
Apr 172012
 

SVN을 사용하여 기존에 개발된 소스 디렉토리를 추가하는 경우가 많습니다.
하지만 기존의 디렉토리 구조가 SVN에 적합하지 않거나, 일부분만 SVN과 연동을 하고자 하는 경우가 있습니다.

이런 경우에 처리하기가 좀 곤란해서 여러가지 꼼수를 사용했는데요. 아래와 같이 “svn add -N” 명령어로 간단하게 해결이 가능합니다.


[root@localhost~]# svn help add
add: 파일과 디렉토리를 버전관리 대상에 넣습니다. 저장소에
추가하도록 스케쥴링 되며, 다음 커밋할 때, 추가됩니다.
사용법: add PATH...

옵션:
  --targets ARG            : ARG로 주어진 파일 내용을 옵션으로 추가합니다
  -N [--non-recursive]     : obsolete; try --depth=files or --depth=immediates
  --depth ARG              : 적용할 단계를 제한합니다. 가능한 인자 ('empty', 'files',
                            'immediates', or 'infinity')
  -q [--quiet]             : 아무것도 출력하지 않거나, 요약 정보만 출력합니다
  --force                  : 강제로 실행합니다
  --no-ignore              : svn:ignore로 지정한 것과 디폴트로 무시하는 파일들을 무시하지 않습니다
  --auto-props             : 자동 속성기능을 활성화합니다
  --no-auto-props          : 자동 속성기능을 비활성화합니다
  --parents                : 임시 상위개체 삽입

글로벌 옵션:
  --username ARG           : arg를 접속에 필요한 사용자 ID로 사용합니다
  --password ARG           : arg를 접속에 필요한 패스워드로 사용합니다
  --no-auth-cache          : 인증 정보를 캐시에 저장하지 않습니다
  --non-interactive        : 대화식 사용자 입력을 기다리지 않습니다
  --trust-server-cert      : accept unknown SSL server certificates without
                             prompting (but only with '--non-interactive')
  --config-dir ARG         : arg로 지정된 디렉토리에서 사용자 구성화일을 읽습니다
  --config-option ARG      : set user configuration option in the format:
                                 FILE:SECTION:OPTION=[VALUE]
                             For example:
                                 servers:global:http-library=serf

Apr 122012
 

SVN을 RPM으로 설치하면 시스템 재시작시 실행해주는 스크립트가 들어가 있지 않다.
이런 경우 대부분 /etc/rc.d/rc.local 에 넣어서 처리를 하는 경우가 대부분인데. 이번에 설치한 CentOS 서버에서는 /etc/rc.d/rc.local 이 제대로 작동하지 않아서 스크립트를 찾아보니 없어서 하나 만들었다.

#!/bin/bash
#
# svnserve        Startup SVN Server
#
# chkconfig: - 85 15
# processname: svnserve
# config: none
# pidfile: /var/run/svnserve.pid
 
# Source function library.
. /etc/rc.d/init.d/functions
 
# Path to the apachectl script, server binary, and short-form for messages.
svnserve=/usr/bin/svnserve
prog=svnserve
pidfile=/var/run/svnserve.pid
logfile=/var/log/svnserve
repository=/home/svn
OPTIONS="-d -r $repository --pid-file $pidfile --log-file $logfile"
RETVAL=0
 
start() {
        echo -n $"Starting $prog: "
        daemon --pidfile=${pidfile} $svnserve $OPTIONS
        RETVAL=$?
        echo
        return $RETVAL
}
 
stop() {
        echo -n $"Stopping $prog: "
        killproc -p ${pidfile}
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${pidfile}
}
 
# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        ;;
  *)
        echo $"Usage: $prog {start|stop|restart}"
        RETVAL=2
esac
 
exit $RETVAL

위와 같은 파일을 /etc/init.d/svnserve 로 생성을 하고, 아래와 같이 서비스 등록을 해주면 된다.

[root@localhost ~]# chmod 755 /etc/init.d/svnserve
[root@localhost ~]# chkconfig --add svnserve 
[root@localhost ~]# /sbin/runlevel
N 3
[root@localhost ~]# chkconfig --level 3 svnserve on

참고로 데스크탑으로 설정한 경우에는 Run Level에 5이므로 level을 5로 설정해야 한다.

아래와 같이 사용을 하면 된다.

[root@localhost log]# /etc/init.d/svnserve stop
svnserve 를 정지 중:                                       [  OK  ]
[root@localhost log]# /etc/init.d/svnserve start
svnserve (을)를 시작 중:                                   [  OK  ]
[root@localhost log]# /etc/init.d/svnserve restart
svnserve 를 정지 중:                                       [  OK  ]
svnserve (을)를 시작 중:                                   [  OK  ]
[root@localhost log]#
Apr 092012
 

svn을 linux/unix 환경에서 사용하는 경우에 checkout을 처음 할때 서버의 계정과 클라이언트의 접속 계정이 다른 경우가 있습니다. 이런 경우에는 패스워드를 저장해두면 편리합니다. 다만 해당 계정이 다른 사람이 접근을 하게 된다면 문제가 되겠지만요.

일단 svn을 사용하게 되면 ~/.subversion 이라는 디렉토리가 생성이 됩니다.
해당 디렉토리에서 plaintext 형태로 패스워드를 저장할지를 선택해두면 편리하게 이용이 가능하다.

[root@localhost public_html]# diff ~/.subversion/servers.org ~/.subversion/servers
156c156
< # store-plaintext-passwords = no
---
> store-plaintext-passwords = yes
Plugin from the creators of Brindes :: More at Plulz Wordpress Plugins