ファイルを最新状態に更新する


バージョン管理ツールを使うと、誰かが行ったバージョンアップを、 ファイル単位で取捨選択して自分の作業に取り込むことができます。


nishitmp さんが編集中のファイルを nishi さんが修正して、 それが新バージョンとして登録されたとします。

このとき、nishitmp さんが cvs status すると、次のように 表示されます。
Status: Needs Patch というのが、新バージョンにするための 「パッチあて」が必要であることを表しています。

===================================================================
File: file1.c           Status: Needs Patch

   Working revision:    1.2     Tue Dec 10 09:26:27 1996
   Repository revision: 1.3     /hp1/speech/CVS/test-cvs/file1.c,v
   Sticky Tag:          (none)
   Sticky Date:         (none)
   Sticky Options:      (none)

===================================================================

このバージョンアップがどのような内容のものであるか、 更新時のコメントを見ることで確認できます。

cvs log (ファイル名)

日付を指定して、それより新しいログのみ表示するには:
cvs log -d ">2000-10-20" (ファイル名)
実際に使用してみます。

nishitmp@langue[165]% cvs log file1.c

RCS file: /hp1/speech/CVS/test-cvs/file1.c,v
Working file: file1.c
head: 1.3
branch:
locks: strict
access list:
symbolic names:
        start: 1.1.1.1
        vox: 1.1.1
keyword substitution: kv
total revisions: 4;     selected revisions: 4
description:
----------------------------
revision 1.3
date: 1996/12/10 10:00:35;  author: nishi;  state: Exp;  lines: +8 -0
file1.c の func() 関数に "too much!!" 表示を追加した。
----------------------------
revision 1.2
date: 1996/12/10 09:26:27;  author: nishitmp;  state: Exp;  lines: +8 -4
func() を作りました。
----------------------------
revision 1.1
date: 1996/12/10 09:07:10;  author: nishi;  state: Exp;
branches:  1.1.1;
Initial revision
----------------------------
revision 1.1.1.1
date: 1996/12/10 09:07:10;  author: nishi;  state: Exp;  lines: +0 -0


CVSで管理します。作りはじめたばかりです。
=============================================================================

登録された修正を自分のファイルに反映させたい場合は cvs update します。

nishitmp@langue[166]% cvs update
cvs update: Updating .
U file1.c


cvs co -r (tag) などとしてリポジトリから取り出されたファイル群には sticky tag とよばれるタグがつきます。
最新版でない作業ファイルからはチェックインができないようにする 必要があります。また、必要ならバージョンを枝分かれさせることも できます。sticky はそのために必要な機能です。 これを解除して update したい場合には、-A オプションをつけて update を 実行します。

% cvs update -A file1.c

nishi@dj.kit.ac.jp / Takuya NISHIMOTO
Last modified: Wed Nov 1 23:38:27 2000