Perforce 覆盖了我忘记签出的代码。我该如何恢复它?
我忘记在修改之前检查源代码文件。 当我得到最后一次修订时,Perforce 覆盖了该文件,所以我的工作完全丢失了。 是否可以恢复该文件?
I forgot to check out a source code file before modifying it.
When I get last revision, Perforce overwrote that file, so my work is totally lost.
Is it possible to recover the file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
为了将来使用,请更新您的客户端工作区,以便指定“noallwrite, noclobber”。如果设置了 noclobber,Perforce 将不会覆盖可写的未打开文件: http://www.perforce.com/perforce/doc.current/manuals/cmdref/client.html
For future use, update your client workspace so that you specify "noallwrite, noclobber". If noclobber is set, Perforce will not overwrite your writable un-opened files: http://www.perforce.com/perforce/doc.current/manuals/cmdref/client.html
如果您使用的是 eclipse,那么可以使用 Compare With -> 检索本地版本。当地历史。它帮助了我。
if you are using eclipse then its possible to retrieve the local version using Compare With -> Local history . It helped me.
仅当您的编辑器或操作系统保存了副本或它被修改了足够长的时间以使其进入您的备份时。 Perforce 不会复制此类文件,它盲目地假设您没有撒谎,并且当您想要编辑文件时,它总是诚实地告诉它。
Only if your editor or your operating system saved a copy or it's been modified long enough that it made its way to your backups. Perforce will not make copies of such files, it blindly assumes that you didn't lie and will always honestly tell it when you want to edit a file.
如果您触发了以下命令(这是一个 FORCE 同步选项),只有这样 Perforce 才会更新您的所有文件……包括可写的文件。唯一的例外是您强制打开的任何文件都不会被覆盖。因此,如果您的文件使用操作系统命令设置为可写,而不是使用 p4 open.. 它们将被 p4sync -f 覆盖。
另一种可能性是您进行了 p4 同步,但仍然会强制覆盖您的可写文件(未使用 p4 打开),因为您的工作区设置没有指定 noallwrite、noclobber。通常默认情况下,这些设置已经指定,因此 Perforce 不会破坏可写文件。
If you fired the following command (which is a FORCE sync option), only then will Perforce update ALL your files.. including ones which are WRITABLE. The only exception is that any file that you have OPENED in perforce will not be overwritten. So if your file was made WRITABLE using OS command, and not using p4 open.. they will get overwritten by p4 sync -f.
The other possibility is that you did p4 sync, and still perforce overwrote your writable files (which were not opened using p4) because your workspace settings don't have noallwrite, noclobber specified. Usually by default, these settings are already specified, so that Perforce doesn't clobber writable files.
这件事最近发生在我身上。由于某种原因,在我“p4 同步”我的工作区并执行 p4 解析后,我注意到我对文件的更改丢失了。我不确定我的更改是否未保存或我尚未签出该文件。但我确实记得我的更改已保存。 :(
我一直在使用 Visual Studio 进行开发,与 Eclipse 不同,它没有本地历史记录。幸运的是,该文件是一个 javascript 文件,我一直在测试我的由于 IE 对某些互联网数据(如 js 文件)进行了一些缓存,因此我所做的是检查它临时保存文件的目录(Internet 选项 -> 浏览器历史记录设置)。 )在那里你会看到保存的文件的不同版本。我确实恢复了我的文件!
在那次事件之后,我安装了一个用于存储文件的本地历史记录http://visualstudiogallery.msdn.microsoft.com/226c2108-9da9-407d-b90d-9783040d27b8
避免这些情况的最佳方法是:
逐渐地。通过这种方式,您将始终拥有重要的版本
您在开发过程中所做的更改。之后,您可以
http://answers.perforce.com/articles/KB_Article/Branching -代码行和合并更改
希望这有帮助!
This has happened to me recently. For some reason, after I "p4 sync"-ed my workspace, and do p4 resolve, I noticed that my changes to a file were missing. I'm not sure if my changes were not saved or I haven't checked out the file. But I really remembered that my changes were saved. :(
I have been using Visual Studio for development and it doesn't have local history unlike in Eclipse. Luckily, that file is a javascript file and I have been testing my application in Internet Explorer. Since IE does some caching on some internet data like js files, what I did is to check the directory where it saves temporarily files (Internet Options -> Browser history settings ) there you'll see different versions of the files saved. I did recover my files! It was really just luck!
After that incident, I installed a plugin for visual studio for storing local history of files everytime it's being saved. http://visualstudiogallery.msdn.microsoft.com/226c2108-9da9-407d-b90d-9783040d27b8
Best thing to avoid these cases is to:
incrementally. In this way you'll always have versions of important
changes you do during development. After this you could
http://answers.perforce.com/articles/KB_Article/Branching-Codelines-and-Merging-Changes
Hope this helps!