I've removed a checked in file from the CVS branch, i.e.:
我从CVS分支中删除了一个已签入的文件,即:
cvs remove -f file.txt
cvs commit
How do I restore the file?
如何恢复文件?
8 个解决方案
#1
38
I believe that:
我相信:
cvs add file.txt
cvs commit file.txt
... will resurrect it from the attic.
......会从阁楼里复活它。
#2
22
I've found that you can not use cvs add
to undo a cvs remove
operation that has already been comitted. So this works:
我发现你不能使用cvs add来撤消已经被调用的cvs删除操作。这样可行:
$ cvs remove -f file.txt
$ cvs add file.txt
but this doesn't work:
但这不起作用:
$ cvs remove -f file.txt
$ cvs commit
$ cvs add file.txt
The simplest method I've found so far is to run cvs status file.txt
to find out the revision number. Then grab the contents of the revision and add it back in:
到目前为止,我发现的最简单的方法是运行cvs status file.txt来查找修订版号。然后获取修订版的内容并将其添加回:
$ cvs update -p -r rev file.txt > file.txt
$ cvs add file.txt
$ cvs commit
#3
4
The cvs add
did not work for me because my cvs version on the server was very old. I have confirmed that it works fine with CVS version 1.11.22.
cvs add对我来说不起作用,因为我在服务器上的cvs版本很旧。我已经确认它适用于CVS版本1.11.22。
#4
4
Try:
cvs add file.txt
cvs update file.txt
cvs commit file.txt
#5
3
Given Harry's lack of success, here's a transcript of what I did to demonstrate that the above answer works (apologies in advance for its length):
鉴于Harry缺乏成功,这里是我所做的事情的成绩单,以证明上述答案有效(事先就其长度道歉):
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
Clearly he's doing the right thing, but the behaviour he's observing is different. Perhaps there's a difference due to CVS version (I'm using 1.11.22 on Windows).
显然他做的是正确的,但他所观察到的行为是不同的。也许由于CVS版本存在差异(我在Windows上使用1.11.22)。
#6
3
cd into $CVSROOT directory and the relevant module directory and then the Attic, edit the fileOfInterest,v and change the line that says Dead; to Exp; and then move the fileOfInterest,v to the directory above.
cd进入$ CVSROOT目录和相关的模块目录,然后是Attic,编辑fileOfInterest,v并更改说死的行;到Exp;然后将fileOfInterest,v移动到上面的目录。
An update in the checked out module will now restore the file.
已签出模块中的更新现在将还原该文件。
#7
1
The simplest, though possible least elegant way to do this is to 'cd' into the CVS directory in the same place as the removed file.
最简单但最不优雅的方法是将“cd”放入与删除文件相同位置的CVS目录中。
Then edit the file called "Entries".
然后编辑名为“条目”的文件。
Find the line representing your removed file. Note that there is a '-' after the /
找到代表已删除文件的行。请注意,/之后有一个' - '
Remove the '-', save the file and voila!
删除' - ',保存文件,瞧!
Yuck, but it works.
哎呀,但它确实有效。
#8
0
Here's what I do. I just create an empty file of the same name, then add and commit it, then retrieve the older version and re-commit that.
这就是我的工作。我只是创建一个同名的空文件,然后添加并提交它,然后检索旧版本并重新提交。
#1
38
I believe that:
我相信:
cvs add file.txt
cvs commit file.txt
... will resurrect it from the attic.
......会从阁楼里复活它。
#2
22
I've found that you can not use cvs add
to undo a cvs remove
operation that has already been comitted. So this works:
我发现你不能使用cvs add来撤消已经被调用的cvs删除操作。这样可行:
$ cvs remove -f file.txt
$ cvs add file.txt
but this doesn't work:
但这不起作用:
$ cvs remove -f file.txt
$ cvs commit
$ cvs add file.txt
The simplest method I've found so far is to run cvs status file.txt
to find out the revision number. Then grab the contents of the revision and add it back in:
到目前为止,我发现的最简单的方法是运行cvs status file.txt来查找修订版号。然后获取修订版的内容并将其添加回:
$ cvs update -p -r rev file.txt > file.txt
$ cvs add file.txt
$ cvs commit
#3
4
The cvs add
did not work for me because my cvs version on the server was very old. I have confirmed that it works fine with CVS version 1.11.22.
cvs add对我来说不起作用,因为我在服务器上的cvs版本很旧。我已经确认它适用于CVS版本1.11.22。
#4
4
Try:
cvs add file.txt
cvs update file.txt
cvs commit file.txt
#5
3
Given Harry's lack of success, here's a transcript of what I did to demonstrate that the above answer works (apologies in advance for its length):
鉴于Harry缺乏成功,这里是我所做的事情的成绩单,以证明上述答案有效(事先就其长度道歉):
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
Clearly he's doing the right thing, but the behaviour he's observing is different. Perhaps there's a difference due to CVS version (I'm using 1.11.22 on Windows).
显然他做的是正确的,但他所观察到的行为是不同的。也许由于CVS版本存在差异(我在Windows上使用1.11.22)。
#6
3
cd into $CVSROOT directory and the relevant module directory and then the Attic, edit the fileOfInterest,v and change the line that says Dead; to Exp; and then move the fileOfInterest,v to the directory above.
cd进入$ CVSROOT目录和相关的模块目录,然后是Attic,编辑fileOfInterest,v并更改说死的行;到Exp;然后将fileOfInterest,v移动到上面的目录。
An update in the checked out module will now restore the file.
已签出模块中的更新现在将还原该文件。
#7
1
The simplest, though possible least elegant way to do this is to 'cd' into the CVS directory in the same place as the removed file.
最简单但最不优雅的方法是将“cd”放入与删除文件相同位置的CVS目录中。
Then edit the file called "Entries".
然后编辑名为“条目”的文件。
Find the line representing your removed file. Note that there is a '-' after the /
找到代表已删除文件的行。请注意,/之后有一个' - '
Remove the '-', save the file and voila!
删除' - ',保存文件,瞧!
Yuck, but it works.
哎呀,但它确实有效。
#8
0
Here's what I do. I just create an empty file of the same name, then add and commit it, then retrieve the older version and re-commit that.
这就是我的工作。我只是创建一个同名的空文件,然后添加并提交它,然后检索旧版本并重新提交。