CVS/Tips
CVS 팁 ¶1.1. CVSROOT 의 정확한 사용 ¶CVSROOT 환경변수는 CVS 로 i/o 되는 파일의 위치를 지정하는 SHELL 환경변수이다. 그러나 CVSROOT 는 초기의 파일 import 나 checkout 에서 필요할뿐 이미 checkout 된 파일을 작업하는데는 필요하지 않다.
보통 CVSROOT 는 다음이 둘 중의 하나이다.
# echo $CVSROOT /home/CVSROOT # 이것은 파일의 저장이 로컬시스템에 이루어 질때이다. 이 경우는 별로 알아야할 내용이 없으므로 넘어간다.
# echo $CVSROOT :ext:@devel.sds.co.kr:/home/CVSROOT # 이 경우는 파일의 저장이 리모트시스템에 이루어 질때이다.
여기서 "ext" 는 리모트시스템임을 나타내며, "@devel.sds.co.kr" 은 서버의 주소를 "@" 앞에는 계정id 가 들어갈 수 있다. "/home/CVSROOT" 는 CVS 파일이 저장되는 저장소를 말한다. 현재의 옵션을 보면 "@"앞에 계정이 지정되어 있지 않으므로 현재 로그인된 계정으로 처리를 하게 된다.
CVSROOT 가 없더라도 처리를 할수 있는 경우가 있는데, 그 경우는 해당 디렉토리에 CVS 디렉토리가 존재하는 경우이다. CVS 디렉토리에 보면 Root 라는 파일이 있는데 내용을 확인해 보면 바로 CVSROOT 의 내용과 동일하다.
# echo CVS/Root :ext:@devel.sds.co.kr:/home/CVSROOT # 그외에 CVS 파일에는 Entries 와 Respository 파일이 있는데 리모트의 CVS 와 동기화 하는 파일이므로 임으로 편집하는것은 정신건강에 해롭다. --;;
리모트 CVS 시스템에 접근하려면 "CVS_RSH" 환경변수가 필요하다. 지정되지 않으면 rsh 를 이용하나 요즘에 rsh 접근을 허용하는 시스템은 없으므로 ssh 를 지정해 주어야 한다.
export CVS_RSH=ssh 모든 부분이 준비되었으면 CVS 를 시작하는 명령은?
# cvs import -m "CVS start" CVS_START CVS_START init 그러면 현재의 디렉토리 아래에 있는 모든 파일을 "CVS_START" 라는 프로젝트로 CVS 에 등록한다.
1.2. 삭제된 파일의 복구 ¶더 이상 필요 없을것 같아서 삭제된 파일의 복구는 다시 add 로서 추가 시킨다. 파일이 현 디렉토리에 없을 경우에는 삭제되기 이전 버전의 파일을 떨어 뜨리면서 추가된다.
$ cvs add mail_view_origin.tpl winchild@devel.sds.co.kr's password: cvs add: Resurrecting file `mail_view_origin.tpl' from revision 1.1. cvs add: Re-adding file `mail_view_origin.tpl' (in place of dead revision 1.2). U mail_view_origin.tpl cvs add: use 'cvs commit' to add this file permanently # 즉 버전 1.1 파일을 떨어뜨리면서 add 가 된것을 보여 주고 있다. 그러면 필요한 대로 파일을 추가로 편집한 후에 commit 으로 추가한다.
# vi mail_view_origin.tpl # cvs commit mail_view_origin.tpl winchild@devel.sds.co.kr's password: Checking in mail_view_origin.tpl; /data/mailnara/webmail-v2.x/templates/templates/main/blue1/korean/mail/mail_view_origin.tpl,v <-- mail_view_origin.tpl new revision: 1.3; previous revision: 1.2 done # 그러면 삭제 버전인 1.2 에서 1.3 으로 변경되면서 파일이 복구가 된다.
1.3. 구 버전 파일을 새 버전파일로 ¶작업을 하다가 보면, 지금 진행중인 버전을 무시하고, 구 버전을 현재의 버전으로 대치하여 계속 작업을 해가야 할 상황이 발생하게 된다. log 를 확인해 보면 1.2 까지 진행된것을 확인할 수 있다.
$ cvs log testfile.php RCS file: /data/CVSROOT/PJWKREPORT/testfile.php,v Working file: testfile.php head: 1.2 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: ---------------------------- revision 1.2 date: 2006/02/01 16:13:55; author: winchild; state: Exp; lines: +2 -1 TEST2 ---------------------------- revision 1.1 date: 2006/02/01 16:13:17; author: winchild; state: Exp; 테슽. ============================================================================= 우선 리비전 1.1 의 파일을 얻어온다.
$ cvs update -r1.1 testfile.php U testfile.php 상태를 확인해 보면 1.1 에서 Sticky Tag 가 걸린것을 확인해 볼수 있다.
$ cvs status testfile.php =================================================================== File: testfile.php Status: Locally Modified Working revision: 1.1 Wed Feb 1 16:14:06 2006 Repository revision: 1.1 /data/CVSROOT/PJWKREPORT/testfile.php,v Sticky Tag: 1.1 Sticky Date: (none) Sticky Options: (none) 우선 현재의 파일을 임시장소로 옮긴다.
$ mv testfile.php /tmp 그리고 현재의 버전 파일을 다시 받는다. 이때 스티키태그를 없애기 위해서 "-A" 옵션을 사용한다.
]$ cvs update -A testfile.php cvs update: warning: testfile.php was lost U testfile.php [winchild@sdsmngr intranet]$ cvs status testfile.php =================================================================== File: testfile.php Status: Up-to-date Working revision: 1.2 Wed Feb 1 16:19:45 2006 Repository revision: 1.2 /data/CVSROOT/PJWKREPORT/testfile.php,v Sticky Tag: (none) Sticky Date: (none) Sticky Options: (none) 이렇게 해야 "commit" 에서 최신버전으로 커밋 되게 된다.
파일을 되돌려 놓고 (Overwrite) 필요한 부분을 수정한 후 커밋한다.
$ mv /tmp/testfile.php . $ vi testfile.php $ cvs commit testfile.php Checking in testfile.php; /data/CVSROOT/PJWKREPORT/testfile.php,v <-- testfile.php new revision: 1.3; previous revision: 1.2 done 1.4. CVS 로 데이터를 생성할 때 파일 퍼미션 문제 ¶현재의 디렉토리 아래의 모든 디렉토리의 access 모드를 775 로 변경하기.
# find . \( -type d -a -exec chmod 775 {} \; \) # find . \( -name "*.php" -a -exec chmod 664 {} \; \) # find . \( -name "*.tpl" -a -exec chmod 664 {} \; \) # find . \( -type d -a -exec chmod 775 {} \; \) -o \( -name "*.php" -a -exec chmod 664 {} \; \) See also CVS/FAQ
|
Standing on head makes smile of frown, but rest of face also upside down. |