英文:
How can I recover my local files after a checkout overwrite in Perforce?
问题
我的本地工作空间已被修改。
在“提交”之前,我点击“检出”,导致我的本地文件被服务器覆盖。
如何恢复我的本地文件?
我在网络上搜索了很长时间,但没有用。请帮助或尝试提供一些实现这一目标的想法。
我在Windows系统中使用Perforce。
我使用VS2010 IDE和QtCreate。
我尝试从VS2010 IDE中恢复,但没有找到。
我尝试在Perforce中查找本地历史记录,但没有找到。
英文:
My local workspace has been modified.
Before "Submit" I click "CheckOut",lead to my local files be coverer by server.
How to recover my local files?
I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
I use perforce in windows system.
I use VS2010 IDE and QtCreate.
I try to recover from VS2010 IDE,but not find.
I try to find local history in perforce,but not find.
答案1
得分: 0
在P4V中执行"check out" (p4 edit
) 不会自动覆盖您的本地文件。如果您修改了本地文件并对其进行了检出,那么您的本地更改仍然存在于您的工作区,并且如果您在待提交变更列表中对已检出的文件执行"Diff",您应该能够看到这些更改。
执行"get latest" (p4 sync
) 默认情况下不会覆盖本地文件;默认行为是如果本地文件已被修改,则跳过更新文件(并发出警告)。此行为可以通过以下方式覆盖:
- 在同步命令上使用"-f"("force")标志
- 在客户端工作区中使用
noclobber
选项
一旦使用p4 edit
(或其他方式)打开了文件,p4 sync
将永远不会覆盖它们(即使您使用了"force"标志)。唯一会覆盖已打开文件的命令是:
p4 revert
(其唯一目的是丢弃您的本地更改,所以只有在您非常确定要放弃未提交的工作时才运行此命令)p4 resolve
(仅在您明确接受"theirs",即存储库文件,而不是将其与您的更改合并时才会覆盖)
尚未提交或搁置的本地更改在Perforce中没有备份,这就是为什么Perforce试图防止意外覆盖这些文件的原因。如果您执行了强制同步并覆盖了您的本地更改,至少从Perforce的角度来看,没有任何方法可以获取它们;您最好的选择是在您的IDE中进行自动备份。如果没有这样的备份,您将需要重新进行更改。
英文:
Doing "check out" in P4V (p4 edit
) does not in itself overwrite your local files. If you modified your local files and checked them out, your local changes are still in your workspace, and you should see the changes if you "Diff" the checked out file in your pending changelist.
Doing a "get latest" (p4 sync
) does not by default overwrite local files; the default behavior is to skip updating the file (and issue a warning) if the local file has been modified. This behavior is overridden by either:
- the
-f
("force") flag on the sync command - the
noclobber
option in the client workspace
Once files have been opened with p4 edit
(or otherwise), p4 sync
will never overwrite them (even if you use the "force" flag). The only commands that will overwrite an open file are:
p4 revert
(whose only purpose is to discard your local changes, so only run this if you're very certain you want to throw your unsubmitted work away)p4 resolve
(and only if you explicitly accept "theirs", i.e. the depot file, in its entirety, rather than merging it with your changes)
Local changes that have not been submitted or shelved are not backed up anywhere in Perforce, which is why Perforce tries to protect those files from being accidentally overwritten. If you did a force-sync and clobbered your local changes, there is not any way to get them back, at least as far as Perforce is concerned; your best option would be automatic backups in your IDE. Failing that, you will need to redo your changes.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论