Node: Finding Out Who Is Watching What, Next: Reminding People To Use Watches, Previous: Controlling What Actions Are Watched, Up: Watches (CVS As Telephone)
cvs edit を実行する前に誰が監視しているか知りたいと思うこともあるでしょ う。また、自分を監視リストに加えずに、誰が何を編集しているのか知りたいこ ともあるでしょう。あるいは、自分の状況を忘れてしまうこともあるでそう。監 視を設定/設定解除してファイルをコミットしたあとは、何を監視していて何を 編集中なのかを見失いがちです。
CVS は誰が監視していて、誰がファイルを編集中なのかを見せてくれるコマンド を2つ用意しています。cvs watchers と cvs editors です:
floss$ whoami jrandom floss$ cvs watch add hello.c floss$ cvs watchers hello.c hello.c jrandom edit unedit commit floss$ cvs watch remove -a unedit hello.c floss$ cvs watchers hello.c hello.c jrandom edit commit floss$ cvs watch add README.txt floss$ cvs watchers README.txt jrandom edit unedit commit hello.c jrandom edit commit floss$
最後の cvs watchers コマンドはファイルを指定していないことに注意して ください。従って、すべてのファイルの監視者を表示します(つまり、監視 者のいるファイルをすべて、ということです)。
他の CVS コマンドと同様、すべての watch コマンドと edit コマンドはこ のように動作します。ファイル名を指定した場合、そのファイルについて動 作します。ディレクトリ名を指定した場合、そのディレクトリとそのサブディ レクトリ内のすべてについて動作します。何も指定しない場合、カレントディ レクトリとそれ以下できる限り深いレベルまですべてについて動作します。 たとえば(同じセッションを続けます):
floss$ cvs watch add a-subdir/whatever.c floss$ cvs watchers README.txt jrandom edit unedit commit hello.c jrandom edit commit a-subdir/whatever.c jrandom edit unedit commit floss$ cvs watch add floss$ cvs watchers README.txt jrandom edit unedit commit foo.gif jrandom edit unedit commit hello.c jrandom edit commit unedit a-subdir/whatever.c jrandom edit unedit commit a-subdir/subsubdir/fish.c jrandom edit unedit commit b-subdir/random.c jrandom edit unedit commit floss$
コマンドの最後2つはそれぞれ、 jrandom をプロジェクト中のすべてのファ
イルの監視者にし、プロジェクト中の全ファイルの監視者リストを表示して
います。cvs watchers
の出力は可変長の情報とタブストップが
混合しているので、カラムがいつも完璧に整列しているわけではありません。
しかし、各行は一貫した形式になっています:
[FILENAME] [whitespace] WATCHER [whitespace] ACTIONS-BEING-WATCHED...
さて、qsmith がファイルをひとつ編集し始めたとして、何が起こるか見て みましょう:
paste$ cvs edit hello.c paste$ cvs watchers README.txt jrandom edit unedit commit foo.gif jrandom edit unedit commit hello.c jrandom edit commit unedit qsmith tedit tunedit tcommit a-subdir/whatever.c jrandom edit unedit commit a-subdir/subsubdir/fish.c jrandom edit unedit commit b-subdir/random.c jrandom edit unedit commit
hello.c にはもう一人監視者が増えました: qsmith です(ファイル名は繰り
返されませんが、行の冒頭は空白文字になっていることに注意してください。
このことは watchers の出力を読むプログラムを書くときに重要になるでしょ
う) hello.c を編集しているので、qsmith はそのファイルを 一時監
視 していることになります。ただし彼が hello.c の新しいリビジョンを
コミットするとそうではなくなってしまいます。各アクションの前にあるプ
レフィクス t
は、これらが一時監視であることを示します。
qsmith がまた、自分自身を hello.c の正規監視者とした場合
paste$ cvs watch add hello.c README.txt jrandom edit unedit commit foo.gif jrandom edit unedit commit hello.c jrandom edit commit unedit qsmith tedit tunedit tcommit edit unedit commit a-subdir/whatever.c jrandom edit unedit commit a-subdir/subsubdir/fish.c jrandom edit unedit commit b-subdir/random.c jrandom edit unedit commit
彼は、一時監視者かつ常時監視者であると表示されます。常時監視状態は一 時監視をオーバライドして次のようになると思ったかもしれませんが:
qsmith edit unedit commit
しかし、どんな順序で起こるかわからないので CVS は一時監視を置き換え ることはできません。qsmith が編集を終わる前に常時監視をやめたとした ら? あるいは監視したままで編集を終えたとしたら? 前者の場合、tedit/ tunedit/tcommit アクションを残したままedit/unedit/commit アクション は削除されます。後者の場合、逆になります。
とにかく、通常は監視者リスト側のことはあまり気にすることはありません。 たいていはプロジェクトのトップレベルで
floss$ cvs watchers
か
floss$ cvs editors
を実行し、誰が何をしているか見ればよいのです。誰がどのアクションに注 意しているか、詳細を知る必要はありません、重要なのは人とファイルです。