Node: Enabling Watches In The Repository, Next: , Previous: How Watches Work, Up: Watches (CVS As Telephone)



Enabling Watches In The Repository

まずは CVSROOT/notify ファイルを編集して、電子メールでの通知を有 効にします。開発者の1人がやってもいいですし、もし開発者にリポジトリ の管理ファイルを変更する権限がなければ、管理者がやってもいいです。ど ちらにしろ、まずは管理領域をチェックアウトして、それから notify ファ イルを編集します:

     floss$ cvs -q co CVSROOT
     U CVSROOT/checkoutlist
     U CVSROOT/commitinfo
     U CVSROOT/config
     U CVSROOT/cvswrappers
     U CVSROOT/editinfo
     U CVSROOT/loginfo
     U CVSROOT/modules
     U CVSROOT/notify
     U CVSROOT/rcsinfo
     U CVSROOT/taginfo
     U CVSROOT/verifymsg
     floss$ cd CVSROOT
     floss$ emacs notify
     ...
     

notify ファイルは、初回編集時にはこのようになっています:

     # The "notify" file controls where notifications from watches set by
     # "cvs watch add" or "cvs edit" are sent. The first entry on a line is
     # a regular expression which is tested against the directory that the
     # change is being made to, relative to the $CVSROOT. If it matches,
     # then the remainder of the line is a filter program that should contain
     # one occurrence of %s for the user to notify, and information on its
     # standard input.
     #
     # "ALL" or "DEFAULT" can be used in place of the regular expression.
     #
     # For example:
     # ALL mail %s -s "CVS notification"
     

最後の行の冒頭の#を取ってコメントをはずすだけです。notify ファ イルは他の管理ファイルと同様、ディレクトリ名に対する正規表現を書ける 柔軟なインタフェースを提供していますが、実際はその柔軟さを活用するこ とはほとんどありません。リポジトリの特定部分にマッチする正規表現を複 数行で書くことがあるとすれば、各プロジェクト用に別々の通知機構を使い たいときだけでしょう。しかし、通常の電子メールは完璧に良い通知機構な ので、大抵はそれを使います。

電子メール通知を指定するには、標準的な Unix マシンではこの行

     ALL mail %s -s "CVS notification"
     

を書けば動きます。このコマンドは通知をサブジェクトCVS notificationの電子メールで送ります(例によって、特殊表現 ALL は全て のディレクトリにマッチします)。この行のコメントをはずしたら、notify ファイルをコミットしてリポジトリに変更を知らせましょう:

     floss$ cvs ci -m "turned on watch notification"
     cvs commit: Examining .
     Checking in notify;
     /usr/local/newrepos/CVSROOT/notify,v  <--  notify
     new revision: 1.2; previous revision: 1.1
     done
     cvs commit: Rebuilding administrative file database
     floss$
     

notify ファイルをこのように編集しさえすればリポジトリの監視ができま す。しかしながら、リモートからプロジェクトに参加している開発者がいる 場合、CVSROOT/users ファイルも編集する必要があります。users ファイルの目的は、外部のメールアドレスを持っているユーザに対し、電子 メール通知をどこへ送信すればよいかを CVS に指示することです。users ファイルの各行の形式は:

     CVS_USERNAME:EMAIL_ADDRESS
     

です。例えば、

     qsmith:quentinsmith@farawayplace.com
     

行の冒頭の CVS ユーザ名というのは、そのユーザ名が CVSROOT/passwd に存在し、かつ pserver アクセスを使っている場合はそのユーザに、そうでな ければ CVS を実行している人のサーバ側のシステムユーザ名に対応します。コ ロンのあとにはそのユーザに通知を送る場合の外部のメールアドレスを書きます。 これを書いている時点では、users ファイルは CVS ディストリビューション中 に存在しません。管理ファイルなので、普通のやりかたでファイルを作成して cvs add して commit してもらって、それに加え CVSROOT/checkoutlist に書き足してください。こうするとリポジトリ内のチェックアウトコピーが常に 保守されるようになります。

これを行うセッションの実地例をお見せしましょう:

     floss$ emacs checkoutlist
       ... (add the line for the users file) ...
     floss$ emacs users
       ... (add the line for qsmith) ...
     floss$ cvs add users
     floss$ cvs ci -m "added users to checkoutlist, qsmith to users"
     cvs commit: Examining .
     Checking in checkoutlist;
     /usr/local/newrepos/CVSROOT/checkoutlist,v  <--  checkoutlist
     new revision: 1.2; previous revision: 1.1
     done
     Checking in users;
     /usr/local/newrepos/CVSROOT/users,v  <--  users
     new revision: 1.2; previous revision: 1.1
     done
     cvs commit: Rebuilding administrative file database
     floss$
     

CVSROOT/users にメールアドレスを拡張形式で書くこともできますが、 空白文字には注意して、全てクオートしてください。例えば、次のは動きますが:

     qsmith:"Quentin Q. Smith <quentinsmith@farawayplace.com>"
     

または

     qsmith:'Quentin Q. Smith <quentinsmith@farawayplace.com>'
     

しかし、これは動きません:

     qsmith:"Quentin Q. Smith" <quentinsmith@farawayplace.com>
     

動くかどうかわからないと思う時は、 notify ファイルに指定するコマンドライ ンを手で動かしてテストしてください。下記の %s

     mail %s -s "CVS notification"
     

users ファイルのコロンのあとに書いたのと同じものに置き換えてください。コ マンドプロンプトでやってみて動いたら、users ファイルでも動きます。

これらが終わった時点で checkoutlist ファイルはこのようになっています:

     # The "checkoutlist" file is used to support additional version controlled
     # administrative files in $CVSROOT/CVSROOT, such as template files.
     #
     # The first entry on a line is a filename which will be checked out from
     # the corresponding RCS file in the $CVSROOT/CVSROOT directory.
     # The remainder of the line is an error message to use if the file cannot
     # be checked out.
     #
     # File format:
     #
     #       [<whitespace>]<filename><whitespace><error message><end-of-line>
     #
     # comment lines begin with '#'
     
     users   Unable to check out 'users' file in CVSROOT.
     

users ファイルはこのようになっていると思います:

     qsmith:quentinsmith@farawayplace.com
     

さて、これでリポジトリの監視用設定はできました。次に開発者が作業コピーで しなければならないことを見ていきましょう。