contents
- リポジトリ管理(サーバでrootで作業、webdavの設定は既にしてある前提)
- クライアントで利用
- 再びリポジトリ管理
subversion
リポジトリ管理(サーバでrootで作業、webdavの設定
は既にしてある前提)
リポジトリを初期化
root@obs# mkdir svn root@obs# svnadmin create --fs-type=fsfs /home/httpd/svn root@obs# chown -R www-data.www-data svn
クライアントで利用
リポジトリに新規プロジェクトを追加
hao% mkdir svn hao% mkdir svn/dots hao% cp -a .zshenv .zshrc .emacs.my.el .mew.el .vim .vimrc svn/dots/ hao% cd svn hao% ls dots/ hao% svn import http://pegandgiff.dyndns.org/svn ログメッセージの変更または指定がなされていません 中断 (a), 続行 (c), 編集 (e) c 追加しています dots 追加しています dots/.mew.el 追加しています dots/.zshrc 追加しています (バイナリ) dots/.emacs.my.el 追加しています dots/.vim 追加しています dots/.vim/colors 追加しています dots/.vim/colors/hao.vim 追加しています dots/.vim/colors/blue.vim 追加しています dots/.vim/colors/typescript 追加しています dots/.vim/colors/new 追加しています dots/.vim/colors/old 追加しています dots/.vim/plugin 追加しています dots/.vim/plugin/cppcomplete.vim 追加しています dots/.zshenv 追加しています dots/.vimrc リビジョン 1 をコミットしました。
リポジトリ全体を指定してcheckout
hao% svn co http://pegandgiff.dyndns.org/svn A svn/dots A svn/dots/.mew.el A svn/dots/.zshrc : : リビジョン 1 をチェックアウトしました。 hao% ls svn/
dotsプロジェクトを指定してcheckout
hao% svn co http://pegandgiff.dyndns.org/svn/dots A dots/.mew.el A dots/.zshrc : : リビジョン 1 をチェックアウトしました。 hao% ls dots/ hao% cd dots hao% ls hao% ls -a ./ ../ .emacs.my.el .mew.el .svn/ .vim/ .vimrc .zshenv .zshrc hao% vi .vimrc hao% svn diff Index: .vimrc =================================================================== --- .vimrc (リビジョン 1) +++ .vimrc (作業コピー) @@ -1,6 +1,5 @@ set encoding=utf-8 set fileencodings=euc-jp,iso-2022-jp,sjis -set incsearch set nocompatible source $VIMRUNTIME/macros/matchit.vim @@ -8,7 +7,7 @@ filetype on filetype indent on filetype plugin on -au FileType ruby,c,perl,php,java,html,xml,yaml set ts=2 sw=2 expandtab +au FileType ruby,c,perl,php,java,html,xml,yaml,groovy set ts=2 sw=2 expandtab "au FileType c set ts=2 sw=2 expandtab
最新の状態に更新。複数人が使用している場合は自分が作業している間にrevisionが 上がっている可能性がある。
hao% svn update リビジョン 1 です。 hao% svn commit ログメッセージの変更または指定がなされていません 中断 (a), 続行 (c), 編集 (e) c 送信しています .vimrc ファイルのデータを送信中です. リビジョン 2 をコミットしました。
dotsプロジェクトに.irbrcと.w3m/を追加
hao% cp ~/.irbrc ./ hao% svn add .irbrc A .irbrc hao% svn add .w3m A .w3m A .w3m/.arrived A .w3m/.textarea A .w3m/.textarea/http___pegandgiff.dyndns.org_hiki_public__c=edit;p=subversion-fid=0_type=textarea_name=contents_id=5.txt A .w3m/.textarea/http___pegandgiff.dyndns.org_hdiary_update.rb-fid=0_type=textarea_name=body_id=7.txt A .w3m/keymap A .w3m/irbrc.txt A .w3m/config A .w3m/bookmark.html
svn addは次回のcommitで追加することを予告。svm commitでリポジトリに追加される。
hao% svn commit 追加しています .irbrc 追加しています .w3m 追加しています .w3m/.arrived 追加しています .w3m/.textarea 追加しています .w3m/.textarea/http___pegandgiff.dyndns.org_hdiary_update.rb-fid=0_type=textarea_name=body_id=7.txt 追加しています .w3m/.textarea/http___pegandgiff.dyndns.org_hiki_public__c=edit;p=subversion-fid=0_type=textarea_name=contents_id=5.txt 追加しています .w3m/bookmark.html 追加しています .w3m/config 追加しています .w3m/irbrc.txt 追加しています .w3m/keymap ファイルのデータを送信中です........ リビジョン 3 をコミットしました。
ファイルの削除も同様。不要なファイルをsvn deleteして、
hao% svn delete .w3m/.textarea D .w3m/.textarea/http___pegandgiff.dyndns.org_hdiary_update.rb-fid=0_type=textarea_name=body_id=7.txt D .w3m/.textarea/http___pegandgiff.dyndns.org_hiki_public__c=edit;p=subversion-fid=0_type=textarea_name=contents_id=5.txt D .w3m/.textarea hao% svn delete .w3m/.arrived D .w3m/.arrived hao% svn delete .vim/colors/new D .vim/colors/new hao% svn delete .vim/colors/old D .vim/colors/old hao% svn delete .vim/colors/typescript D .vim/colors/typescript
svn commitでリポジトリに反映
hao% svn commit 削除しています .vim/colors/new 削除しています .vim/colors/old 削除しています .vim/colors/typescript 削除しています .w3m/.arrived 削除しています .w3m/.textarea リビジョン 4 をコミットしました。
任意のrevision間のdiff
hao% svn diff -r 1:2 http://pegandgiff.dyndns.org/svn/ Index: dots/.vimrc =================================================================== --- dots/.vimrc (リビジョン 1) +++ dots/.vimrc (リビジョン 2) @@ -1,6 +1,5 @@ set encoding=utf-8 : :
再びリポジトリ管理
管理の対象はリポジトリ全体であり、個々のファイルではないことに注意。
revisionはリポジトリに付けられているので当然なのだが、プロジェクト単位にできないと困ることはないなだろうか?
過去のrevision間のdiffとかは管理コマンドでしかできないらしい...svn diff -r rev1:rev2でできます。
revision 2とrevision 1のdiff(unified形式)
root@obs# svnlook diff -r 2 /home/httpd/svn
ヒストリ(意味わからん...)
root@obs# svnlook history /home/httpd/svn リビジョン パス -------- ---- 4 / 3 / 2 / 1 / 0 /
revision 1をツリー表示
root@obs# svnlook tree -r 1 /home/httpd/svn --show-ids / <0.0.1> dots/ <1.0.1> .mew.el <2.0.1> .zshrc <3.0.1> .vim/ <5.0.1> colors/ <6.0.1> hao.vim <7.0.1> blue.vim <8.0.1> typescript <9.0.1> new <a.0.1> old <b.0.1> plugin/ <c.0.1> cppcomplete.vim <d.0.1> .emacs.my.el <4.0.1> .zshenv <e.0.1> .vimrc <f.0.1>
参考文献
Last modified: 2011-03-21 by Unknown