需要恢复被 p4 revert 覆盖的本地更改
我的工作区中有一个待处理的变更列表。
我错误地通过恢复到软件仓库来恢复了其中一个文件。日食抹去了当地的历史。我不确定是否 perforce 会保留任何待处理变更列表的历史记录。
是否可以恢复此类文件?
I had a pending changelist in my workspace.
By mistake I reverted one of the files by reverting to depot. Eclipse wiped off the local history. I am not sure if perforce keeps any history for pending changelists.
Is it possible to recover such file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
(据我所知)简单的答案是“不”。 Perforce 不会保留(未提交的)变更列表的历史记录。
除非您碰巧使用的操作系统提供快照(或者您的文件服务器提供),否则您就不走运了。
The simple answer (to my knowledge) is "no". Perforce doesn't keep a history for (non-submitted) changelists.
Unless you happen to be on an operating system that offers snapshots (or your file-server does), you are out of luck.
您将来可能尝试的另一件事是养成始终使用“p4 revert -a”的习惯(例如,通过定义本地别名)。如果“p4 revert -a”是默认值,那就太好了,并且您需要传递一个特殊标志来指示您想要恢复在本地更改的文件,但不幸的是,目前情况并非如此。
Another thing you might try for the future is to get in the habit (e.g., by defining a local alias) of always using 'p4 revert -a'. It would be nice if 'p4 revert -a' had been the default, and you had needed to pass a special flag to indicate that you wanted to revert a file that you had locally changed, but that's not the way it currently is, unfortunately.
我也面临着同样的问题。我的工作区被错误地从 cvs 覆盖,我丢失了一些本地文件中的所有更改。我发现在 eclipse UI 资源历史记录中文件显示为空白,但 eclipse 创建的历史文件仍然存在于 *$eclipse-workspace.metadata.plugins\org.eclipse.core.resources.history* 文件夹。使用任何文本编辑器(如记事本++)在所有文件夹中搜索文件名,您可以轻松地从那里恢复文件。我只是做了同样的事情来恢复我的文件。
I was also facing the same issue. my workspace over written from cvs by mistake and I lost all the changes in some of my local files.I found that in eclipse UI resource history has shown as blank for the files but the history file created by the eclipse still exist in *$eclipse-workspace.metadata.plugins\org.eclipse.core.resources.history* folder. Use any text editor like notepad++ to search for the name of your file in all the folders and you can easily recover the file from there. I just did the same to recover my files.
如果Visual studio是IDE编辑菜单下的撤消恢复文件
If Visual studio is the IDE undo under edit menu recovers the files
驱动器快照是防止将来发生这种情况的最佳选择。对于我个人的非重要项目,我使用 Git 进行签入;但 dropbox 可轻松实现多机工作和未签入代码的快照(甚至到本地存储库)
Drive snapshots are your best bet to prevent this in the future. For my personal non important projects, I use a Git for checkins; but dropbox for easy multi-machine work and snapshotting of non checked in code (even to local repo)
唯一的解决方案是备份/快照。如果您在公司环境中,请联系您的 IT 部门。
如果您处于 UNIX 公司环境中,您可能有一个 ~/.snapshot 目录,用于保存最近几天所有文件的每小时快照。
The only solution is having backups/snapshots. If you're in a corporate environment, contact your IT department.
If you are in a unix corporate environment, you might have a ~/.snapshot directory that keeps hourly snapshots of all your files for the last few days.