2008-09-27 54 views

回答

37

筆者認爲:

cvs add file.txt 
cvs commit file.txt 

...會從閣樓復活它。

21

我發現你不能使用cvs add來撤銷已經完成的cvs remove操作。所以這個工程:

$ cvs remove -f file.txt 
$ cvs add file.txt 

但這不起作用:

$ cvs remove -f file.txt 
$ cvs commit 
$ cvs add file.txt 

到目前爲止我發現最簡單的方法是運行cvs status file.txt找出版本號。然後抓住修訂的內容,並重新添加它:

$ cvs update -p -r rev file.txt > file.txt 
$ cvs add file.txt 
$ cvs commit 
+1

忘記了文件的最後修訂版本是什麼?cvs log [FILENAME] – jjohn 2014-09-15 13:52:00

3

鑑於哈里缺乏成功的,這裏是我所做的,以證明上述答案的作品(道歉提前爲它的長度)成績單:

C:\foo>dir 
Volume in drive C is Local Disk 
Volume Serial Number is 344F-1517 

Directory of C:\foo 

28/09/2008 05:12 PM <DIR>   . 
28/09/2008 05:12 PM <DIR>   .. 
28/09/2008 05:12 PM <DIR>   CVS 
28/09/2008 05:11 PM    19 file.txt 
       1 File(s)    19 bytes 
       3 Dir(s) 22,686,416,896 bytes free 

C:\foo>cvs status file.txt 
=================================================================== 
File: file.txt   Status: Up-to-date 

    Working revision: 1.2  Sun Sep 28 07:11:58 2008 
    Repository revision: 1.2  C:\jason\CVSROOT/foo/file.txt,v 
    Sticky Tag:   (none) 
    Sticky Date:   (none) 
    Sticky Options:  (none) 


C:\foo>cvs rm -f file.txt 
cvs remove: scheduling `file.txt' for removal 
cvs remove: use 'cvs commit' to remove this file permanently 

C:\foo>cvs commit -m "" file.txt 
Removing file.txt; 
C:\jason\CVSROOT/foo/file.txt,v <-- file.txt 
new revision: delete; previous revision: 1.2 
done 

C:\foo>cvs status file.txt 
=================================================================== 
File: no file file.txt   Status: Up-to-date 

    Working revision: No entry for file.txt 
    Repository revision: 1.3  C:\jason\CVSROOT/foo/Attic/file.txt,v 

C:\foo>more file.txt 
Cannot access file C:\foo\file.txt 

C:\foo>dir 
Volume in drive C is Local Disk 
Volume Serial Number is 344F-1517 

Directory of C:\foo 

28/09/2008 05:12 PM <DIR>   . 
28/09/2008 05:12 PM <DIR>   .. 
28/09/2008 05:12 PM <DIR>   CVS 
       0 File(s)    0 bytes 
       3 Dir(s) 22,686,400,512 bytes free 

C:\foo>cvs add file.txt 
cvs add: Resurrecting file `file.txt' from revision 1.2. 
U file.txt 
cvs add: Re-adding file `file.txt' (in place of dead revision 1.3). 
cvs add: use 'cvs commit' to add this file permanently 

C:\foo>cvs commit -m "" file.txt 
Checking in file.txt; 
C:\jason\CVSROOT/foo/file.txt,v <-- file.txt 
new revision: 1.4; previous revision: 1.3 
done 

C:\foo>more file.txt 
This is a test... 

C:\jason\work\dev1\nrta\foo>dir 
Volume in drive C is Local Disk 
Volume Serial Number is 344F-1517 

Directory of C:\jason\foo 

28/09/2008 05:15 PM <DIR>   . 
28/09/2008 05:15 PM <DIR>   .. 
28/09/2008 05:13 PM <DIR>   CVS 
28/09/2008 05:13 PM    19 file.txt 
       1 File(s)    19 bytes 
       3 Dir(s) 22,686,375,936 bytes free 

顯然他做的是正確的事情,但他觀察的行爲是不同的。也許由於CVS版本的不同(我在Windows上使用1.11.22)。

+0

感謝Jason花時間提供詳細的回覆。 – Harry 2008-09-28 08:35:02

4

cvs add沒有爲我工作,因爲我的服務器上的CVS版本很舊。我已經確認它可以在CVS版本1.11.22下正常工作。

+0

我很高興我們達到了最低點,哈利。我有點擔心。 :-) – 2008-09-28 08:31:21

0

這就是我所做的。我只是創建一個同名的空文件,然後添加並提交它,然後檢索舊版本並重新提交。

4

嘗試:

cvs add file.txt 
cvs update file.txt 
cvs commit file.txt 
3

cd到$ CVSROOT目錄和相關模塊的目錄,然後閣樓上, 編輯fileOfInterest,v和改變,說死行;到Exp;然後將fileOfInterest,v移動到上面的目錄。

檢出模塊中的更新現在將恢復該文件。

1

做到這一點最簡單但最簡單的方法是在被刪除文件的相同位置'cd'到CVS目錄中。

然後編輯名爲「條目」的文件。

找到代表您刪除文件的行。請注意,在「 - 」後面有一個' - ',然後刪除' - ',保存該文件,然後瞧!

Yuck,但它的工作原理。