Subversion Best Practice 和訳にチャレンジ
原文
訳文
原文訳文併記版
Here’s a summary of an OSCON session I’m attending right now. Every seat in this room is full.
これは、たった今私が出席しているOSCONのまとめです。この部屋は人でいっぱいだよ。
This talk is done by Ben Collins-Sussman & Brian W. Fitzpatrick (Google employees).
このお話はグーグル勤務のBen Collins-Sussman と Brian W. Fitzpatrickによるものです。
* Server best practices
* Subversionサーバベストプラクティス
o Which server to use? Depends.
o svnとApacheどっちを使うか? →場合による
+ svnserve: Fast, light, quick. Good for simple setups. svn+ssh if you need encryption.
+ svnserve: 速くて軽くてすぐできる. 簡易セットアップ用。暗号化したければsvn+sshで。
+ Apache: Mount as a network share; flexible authentication; browsing of repository; logging.
+ Apache: ネット上で共有する場合; 柔軟な認証が可能; ブラウザでレポジトリを見れる; ログを残す場合。
o One repository or many? Depends.
o レポジトリは1つか複数か?→場合による
+ One, when: shared users, shared code; reduce maintenance burden (ASF uses a single repository for their entire directory of projects).
+ 1つの場合: ユーザーは共有だしコードも共有。なのでメンテナンス負荷は減る (ASF uses a single repository for their entire directory of projects).
+ Many, when: radically different access policies or data types (ie, text store versus binary store).
+ 複数の場合: 全く異なるアクセスポリシーやデータ形式を適用できる (例えば、テキストとバイナリとかね).
o Authorization policy
o 認証ポリシー
+ svn 1.3 supports path-based authorization.
+ svn 1.3 からパスレベルの認証をサポート。
+ Use no authorization if possible (open-source context).
+ オープンソースが前提なら認証無しにもできる。
+ Encourage a culture of trust.
+ 信頼感が生まれる。
+ Remember, you can’t really delete anything.
+ 全部消すなんて無理ってことよ。
o Repository browsing tools
o レポジトリを閲覧する道具
+ Should you set one up? The Apache server comes with a free browser. Doesn’t support diffs, or selecting specific revisions. Annotations, etc.
+ 何を使うべきか? Apacheがフリーブラウザと共に誕生したのだから、普通はブラウザでしょ。でも差分や注記の表示は未サポートなので、特定のリビジョンを指定しましょう。
+ Hardcore users will use the svn commands.
+ ギークはsvnコマンドがお好き。
+ Ones they like: ViewVC, Trac
+ あとギークが好きなのは ViewVC, Trac とかそんなとこ。
o Hook scripts
o フックスクリプト
+ Pre-commit hooks
+ コミット前のフック (Pre-commit hooks)
# Don’t attempt to modify the transaction. Instead, send an error and block the transaction.
# 処理中に変更をしないこと。代わりにエラーを吐いて処理を止めるよう。
# Hooks we like:
# 我々が愛用するフック
* check-case-insensitive.py (checks to prevent against checkins that would create conflicts with other files that might differ in case alone)
* check-case-insensitive.py (コミット時に大文字小文字が異なる同じ名前のファイルがすでにあるか確認する)
+ Post commit hooks
+ コミット後のフック (Post commit hooks)
# Run them in the background &
# & を付けてバックグラウンドで実行 (訳注:時間のかかる処理をしてもコミットが遅くならないように)
# Hooks we like:
# 我々が愛用するフック
* mailer.py (email notification of commits)
* mailer.py (コミットをメールで通知)
* CIA bot (IRC channel notification of commits)
* CIA bot (コミットをIRCで通知)
o Locking/Reserved Checkouts
o ロック/リザーブ チェックアウト
+ You have the ability to not be concurrent. When would you do this?
+ 同時編集させなくすることができる。どんな時にこれらを使うのか?
+ Binary file modifications; or other files that can’t be merged. You’d want to lock such files to prevent conflicts.
+ バイナリファイルの変更; その他マージ出来ないファイル. あなたはそのようなファイル群のコンフリクトを防ぐためにロックを必要としていただろう。
+ Property svn:needs-lock accomodates this. It checks out the file as read-only, and becomes read/write once you lock it for modifications. If you try to lock and can’t, it’s because someone else is working on the file.
+ svn:needs-lockプロパティが設定される。チェックアウト時にはファイルは読み取り専用になっていて、読み書きする度に修正しなければならない。ロックしようとしても出来ない。誰か他の人が編集中だから。
o Autoversioning
o 自動バージョン管理
+ Only for Apache server
+ Apache専用
+ Good for non-coding projects
+ コーディングのないプロジェクト向け
+ Good for non-techies
+ 非エンジニア向け
+ Bad for traditional coding projects
+ 旧来のコーディングプロジェクトには向いていない
# no log messages
# ログメッセージが無い
# potential email spam for unauthorized repos.
# 公開レポジトリは潜在的にEメールスパムのもとになる
# empty revisions
# リビジョンが無い
+ Good for tricking people into using version control. :)
+ みんなにバージョン管理してもらえる。
o Repository maintenance
o レポジトリ管理
+ Backup: dump versus hotcopy
+ バックアップ: dump vs hotcopy
# When you dump, it checks out every single revision in the repository.
# dumpの場合。常に単体のリビジョンがチェックアウトされる。
# hotcopy is a file copy of your repository database.
# hotcopyはレポジトリDBのファイルコピーである。
+ History obliteration should be avoided
+ 履歴の抹消は避けなければならない
# Takes a long time
# 時間がかかる。
# Invalidates working copies
# ワーキングコピーが無効になる。
# Why? Someone did something stupid, like checked in a list of passwords, government secrets, etc.
# それでも必要なときがある。パスワードや機密情報をコミットしちゃったりするやつが…
# svndumpfilter has limitations
# svndumpfilterには限界がある。
# If you must obliterate, try selectively dumping
# もし抹消する必要に迫られたら、抜粋してdumpしてみよう。
+ hotcopy versus rsync: Use hotcopy to make the backup to preserve consistency, then use rsync on that.
+ hotcopy vs rsync: 常にhotcopyを使ってバックアップを作り、できたバックアップをrsyncしよう。
o Encourage Code Review
o コードレビューのススメ
+ Commit often
+ 頻繁にコミットしよう。
+ Commit in small, discrete chunks
+ コミットは小さく、個々の塊で。
+ Use consistent log messages
+ 一貫性のあるログメッセージを使おう。
+ Send commit emails to team
+ チームにコミットメールを送る
+ For example: fix a bug, commit, fix a bug, commit.
+ 例: バグ修正、コミット、バグ修正、コミット。
o Branches
o ブランチ
+ Don’t fear them!
+ 怖がらなくていいよ!
+ Use types of branches
+ ブランチの種類
# Short-lived task branch
# 短期のタスクブランチ
# Medium-lived feature branch
# 中期のブランチ
# Long-lived release branch
# 長期のリリースブランチ
+ Have a release policy
+ リリースポリシーを持とう
o Merge Tracking
o マージ追跡
+ Needs to be managed by humans
+ 人間による管理が必要
+ Describe merges in log messages (editor: we include the actual “svn merge” command that was used)
+ ログメッセージにはマージを表す内容を書こう。 (編注: うちの場合は “svn merge” した結果を貼ってる)
+ svnmerge.py
+ svnmerge.py
+ Subversion 1.5: real merge tracking!
+ Subversion 1.5: 真のマージ追跡!
# no, really.
# いや、マジで。
# available in the Subversion trunk.
# Subversion trunkから入手できるようになる。
# May be available in 6 months or so.
# 6ヶ月以内かな。
o Standardize on one locale
o 一つのlocaleへ標準化
+ All filenames and log messages are stored in UTF-8 on the server.
+ 全てのファイル名とログメッセージはUTF-8でサーバーに保存される。
+ Choose one locale and stick with it… or else.
+ 一つのlocaleで頑張るか、あるいは。
o Use Autoprops
o Autopropsを使おう
+ No, the server can’t transmit them to clients. Maybe in the future.
+ No, the server can’t transmit them to clients. 将来きっとね。
+ Useful autoprops:
+ 実用的なautoprops
# svn:mime-type
# svn:mime-type
# svn:eol-style
# svn:eol-style
# svn:needs-lock
# svn:needs-lock
* Cool Client Tricks
* クライアント側での便利なトリック
o Switching to a branch in mid-flight
o 途中でブランチに切り替えられる
o In-place “import”
o その場で “import”
$ cd dataset/
$ cd dataset/
$ svn mkdir URL
$ svn mkdir URL
$ svn checkout URL .
$ svn checkout URL .
$ svn add *
$ svn add *
$ svn commit
$ svn commit
o Mixing and Matching Components
o Mixing and Matching Components
+ svn:externals
+ svn:externals
+ svn switch on empty directories
+ 空ディレクトリで svn switch
o Managing a website in Subversion
o Subversionでウェブサイトを管理
+ serve site from a working copy
+ ワーキングコピーを配置
+ disable httpd access to .svn/
+ .svn/へのアクセスを無効化する
+ write post-commit hooks to update working copy
+ post-commitフックでワーキングコピーをアップデートする
o Use svnversion
o svnversionを使う
+ $Revision$ doesn't do what you think
+ $Revision$ キーワードは、あなたが思っているものとは違う
+ This command yields the revision of the working copy.
+ このコマンドはワーキングコピーのリビジョンがもとになる。
o Use a template
o テンプレートを使う
+ Dealing with a “mostly standardized file”:
+ ほとんどいつも同じファイルの取り扱い
# Commit a template of file to repository
# リポジトリにテンプレートをコミットしておく
# Have build system copy it to unversioned file
# それをビルドシステムが新規ファイルとしてコピー
# Users edit unversioned file
# ユーザーはそのコピーを編集する