「cvs server: **** added independently by second party」の対処法

いまだにバージョン管理にCVSを使って、コンテンツとソースコードを管理している所があるんだけど、久しぶりにとあるファイルをcommitしたしたら以下のエラーが出た。

$ cvs commit xxx.html 
cvs commit: use `cvs add' to create an entry for xxx.html
cvs [commit aborted]: correct above errors first!

うーん、このファイルは以前にcommitしたはずなんだけどなぁ。とりあえずaddしてみた。

$ cvs add xxx.html 
cvs server: xxx.html added independently by second party

どうやら何かおかしなことになっているみたい。

ってことで以下の手順で対応することにした。

  1. いったんファイルを別名で退避する
  2. cvs up
  3. 退避したファイルで上書き
  4. cvs commit

具体的には、こんな感じで、問題は解消した。

$ mv xxx.html _xxx.html
$ cvs up xxx.html
$ mv _xxx.html xxx.html
$ cvs commit xxx.html