CVS���[�U�̂��߂�Subversion TIPS

2007/10/31

�uThe Top Ten Subversion Tips for CVS Users�v�Ƃ����L��������܂����B Subversion�̊J�����s���Ă���Google�Ђ�Brian Fitzpatrick���������Ă���u���O�L���̂悤�ł��B ���X��2004�N��ONLamp�Ŕ��\���ꂽ���̂������ł��B

�ȉ��A�v��ł��B ���Ȃǂ̉”\��������̂Ō����������������B

1. �X�e�[�^�X������ɂ�status�𗘗p���悤

CVS�ł́A�茳�̃R�s�[�ƍŐV���|�W�g���Ƃ̈Ⴂ���������ꍇ�A cvs update���g���܂����Acvs update�����Ă��܂��ƁA�Ⴂ��m��Ɠ����Ɏ茳�̃R�s�[���ŐV�̏�Ԃ�update����Ă��܂��܂��B (-n���g��Ȃ��ꍇ�B�܂��Astatus�R�}���h������܂������܂�g������͗ǂ�����܂���B) Subversion�ł́Aupdate���s�킸�ɏ�Ԃ�����m�鎖���ł��܂��B


$ svn status
D fish.c
A shrimp.c
M anemone.c

Subversion�ł́A�폜/�lj�/�ύX�Ȃǂ��������t�@�C���Ɋւ��Ă̂ݏ�񂪕\������܂��B �S�Ẵt�@�C���Ɋւ����Ԃ�m�肽����΁A--verbose�I�v�V������lj����܂��B


$ svn status --verbose
44 23 sally README
44 30 sally INSTALL
44 35 harry trout.c
D 44 19 ira fish.c
A 0 ? ? shrimp.cM 0 ? ? anemone.c
44 36 harry things/rocks.txt

svn update���s�����Ƃ��ɂǂ̃t�@�C�����ύX����邩��m��ɂ́A--show-updates�I�v�V�����𗘗p���܂��B


$ svn status --show-updates --verbose
* 44 23 sally README
44 30 sally INSTALL
* 44 35 harry trout.c
D 44 19 ira fish.c
A 0 ? ? shrimp.c
M * 44 32 sally anemone.c
44 36 harry things/rocks.txt

update�����t�@�C���̐擪�ɂ́u*�v�}�[�N���‚��܂��B

2. �ړ����ł���

CVS�ł͈�x����Ă��܂������̂͏����ȊO�ɂ͂ł��Ȃ�(�{�C�ł�肽����΃��|�W�g�����������K�v)�̂ŁA�ŏ��Ƀf�B���N�g����t�@�C���̈ʒu�Ɋւ��čl���邽�߂ɔ��ɑ����̎��Ԃ��₷�ꍇ������܂��B Subversion�ł̓f�B���N�g����t�@�C���̈ړ����ȒP�ɍs���܂��B


$ svn move foo.c bar.c
A bar.c
D foo.c

���̕ύX��svn commit�����s����Ɣ��f����܂��B

����ɁAURL�Ŏw�肵�ăt�@�C�����ړ����邱�Ƃ��ł��܂��B


$ svn move -m "Move a file" http://svn.red-bean.com/repos/foo.c \
http://svn.red-bean.com/repos/bar.c

3. �^�O�ƃu�����`�̓R�s�[�ł���

CVS�ɂ́Acvs tag�Acvs tag -b�Acvs rtag�Acvs rtag -b�ɂ���ă^�O��u�����`����鎖���ł��܂��B Subversion�ł́A�S�Ă��R�s�[�ł��B


 $ svn copy -m "Tag rc1 rel." http://svn.red-bean.com/repos/trunk \
http://svn.red-bean.com/repos/tags/1.0rc1

���C���g�����N�Ɠ������e�����ƒu�����`���쐬����ɂ́A�g�����N��branches directory�ɃR�s�[���邾���ł��B �^�O�����|�W�g�����ɂ���R�s�[�ւ̃p�X�ł��B �Ⴂ�̓^�O��/tags�ȉ��ɂ���A�u�����`��/branches�ȉ��ɂ��邱�Ƃł��B

�^�O��u�����`�̃o�[�W���������������R�s�[���쐬���邱�Ƃ��”\�ł��B


$ svn copy -m "Mixed branch." . http://svn.red-bean.com/repos/branch/1.2-mixed

4. "delete and update"�̑����"Revert"���g��

CVS�ł́A���Ȃ��������Ƃ��Ɉȉ��̂悤�Ȏ�������Ǝv���܂��B


$ rm I-made-a-boo-boo.txt
$ cvs up
I-made-a-boo-boo.txt
U I-made-a-boo-boo.txt

����ł́A2��ɕ����ăR�}���h��ł��Ȃ���΂Ȃ�Ȃ��ł����Aupdate���ꂽ�Ƃ��Ƀt�@�C�����ŐV�̂��̂ɂȂ��Ă��܂��ꍇ������܂��B

Subversion�ł́A.svn�f�B���N�g���Ɍ��t�@�C����ێ����Ă���̂ŁArevert�R�}���h�ł��ꂪ�s���܂��B


 $ svn revert I-made-a-boo-boo.txt
Reverted 'I-made-a-boo-boo.txt'

����́A�l�b�g���[�N�������‹��Ȃǂœ��ɕ֗��ł��B

5. �]�v�Ȃ����b�͂��Ȃ�

CVS��CR��CRLF�ɕύX������A$Id$�̓��e��ύX�����肵�܂��B �����̋@�\�͕֗��ł����A�o�C�i���t�@�C����䖳���ɂ��Ă���܂��B

Subversion�ł́A�e�L�X�g���o�C�i���������悤�Ɉ����܂��B

Subversion�͂��肢���Ȃ�����͗]�v�Ȏ��͂��܂���B �J��Ԃ��܂��B Subversion�͂��肢���Ȃ�����͗]�v�Ȏ��͂��܂���B

�e�L�X�g�t�@�C���ʼn��s�R�[�h�̎����ύX�����s�������ꍇ�ɂ�svn:eol-style�v���p�e�B��native�ɃZ�b�g���Acommit���܂��B


 $ svn propset svn:eol-style native halibut.c

6. ���O

Subversion�́ACVS�̂悤�ɓ����R�~�b�g���ǂ����ǂ��킩��Ȃ��t�@�C���̃��O�Q�ł͂Ȃ��A�܂Ƃ܂������Ƃ��ă��O���o�͂��Ă���܂��B CVS�ɂ�commit���O���[�v�Ƃ��Ĉ����Ƃ����T�O������܂���B

�ȉ��̗�̂悤�ɁA�����w�肹����svn log�����s����ƁA�J�����g���[�L���O�f�B���N�g���ł̃��r�W����1���猻�݂܂ł̃��O��\�����܂��B


 $ svn log --verbose
---------------------------------------------------------------------
r3 | sally | Mon, 15 Jul 2002 18:03:46 -0500 | 1 lineChanged paths:
M /trunk/sandwich.txt

Added include lines and corrected # of cheese slices.
---------------------------------------------------------------------
r2 | harry | Mon, 15 Jul 2002 17:47:57 -0500 | 1 lineChanged paths:
M /trunk/sandwich.txt

Outline sandwich fixins.
---------------------------------------------------------------------
r1 | sally | Mon, 15 Jul 2002 17:40:08 -0500 | 1 lineChanged paths:
A /trunk/sandwich.txt

Initial import
---------------------------------------------------------------------

7. ���s����commit��������

�Ⴆ�΁A���r�W����303�Ƃ��čs�����ύX���S���̊ԈႢ�������Ƃ��܂��B ����commit�͂����ׂ��ł͂Ȃ�����commit�ł��B Subversion�ł́Asvn merge���g���ĕύX���uundo�v���邱�Ƃ��”\�ł��B


 $ svn merge -r 303:302 http://svn.example.com/repos/calc/trunk
U oyster.c

8. �폜�����A�C�e���̕���

���|�W�g������폜���Ă��܂����t�@�C���𕜊�������ɂ́A�폜�����O�̂�r�W��������svn copy���g���̂��ȒP�ł��B svn log -v ���g���ăt�@�C�����폜���ꂽ���r�W������T���āA�R�s�[���s���܂��傤�B


 $ svn copy --revision 807 \
http://svn.red-bean.com/repos/trunk/perch.c ./perch.c

9. �u�����`�փX�C�b�`����

CVS�ł́A��ƃf�B���N�g�����u�����`�ֈڍs����ɂ̓u�����`�����w�肵��update�����܂��B Subversion�̓^�O��u�����`�����|�W�g�����̃p�X�Ƃ��Ĉ����Ă���̂ŁA�u�����`�����g����svn update�����邱�Ƃ͂ł��܂���B Subversion�ł�svn switch�R�}���h���g���܂��傤�B


 $ svn switch http://svn.red-bean.com/repos/branches/vendors-with-fix .
U myproj/foo.txt
U myproj/bar.txt
U myproj/baz.c
U myproj/qux.c
Updated to revision 31.

10. ���|�W�g�����u���E�Y������A�}�E���g������

Subversion���|�W�g����Apache HTTP �T�[�o�Œ񋟂��Ă���ꍇ�A�����‚��֗��Ȃ��̂�����܂��B

�܂��A�u���E�U�Ń��|�W�g���������Ă܂�邱�Ƃ��ł��܂��B ���ɁADAV�𗝉�����OS�ł���΁A�ǂݍ��ݐ�p�Ń}�E���g���邱�Ƃ��”\�ł��B

�ŋ߂̃G���g��

�ߋ��L��

�ߋ��L���ꗗ

IPv6��b����

YouTube�`�����l������Ă܂��I