Perforce 未正确同步文件
我正在使用图形工具 Perforce P4V 与我工作中的 Perforce 服务器进行交互。我有一个添加到仓库的项目,我不小心从本地计算机上的工作区中删除了它,问题是当我使用“获取修订操作”(相当于同步的 GUI)时,文件不会更新,即我可以查看服务器上我想要的文件,但它们无法与我的本地电脑正确同步。令我沮丧的是,文件没有从服务器中提取。我假设应该发生的是,如果文件在我的本地 PC 上以任何方式发生更改,我应该能够从服务器获取修订版本,然后服务器将数据提取到我的本地 PC 并覆盖我的 PC 上本地的更改,但这并没有发生。我有什么遗漏的吗?
I'm using Perforce P4V, the graphical tool, to interface with my Perforce server here at work. I have a project I added to the depot and I accidentally deleted it from my workspace on my local computer, problem is when I use the Get Revision Action (the GUI equivalent of sync), the files don't get updated, i.e. I can see the files on the server that I want, but they won't sync correctly with my local PC. It's frustrating me that the files aren't getting pulled from the server. What I'm assuming should be happening is if files are altered in anyway on my local PC, I should be able to grab the revision from the server, which then pulls the data to my local PC and overwrites the changes locally on my PC, but that isn't happening. Is there something I'm missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Perforce 会跟踪它认为您在本地工作站上拥有的文件。如果您在本地删除这些文件(并且不“告诉”perforce),那么 Perforce 仍然会认为您拥有这些文件。如果你想找回它们,你需要“强制同步”文件。在 p4v 中,您可以使用“获取修订...”项,在随后的对话框中,您可以选中“强制操作”复选框来告诉 Perforce 再次为您提供所有文件,无论 Perforce 是否认为您需要它们。
为了完成信息,如果您确实想要在本地删除文件,您可以通过 p4v 选择“从工作空间删除”项来完成此操作。这样做将在本地删除这些文件,并告诉您不再拥有这些文件,以便下次同步时,将从服务器检索这些文件。
Perforce keeps track of the files that it thinks that you have on your local workstation. If you delete those files locally (and don't "tell" perforce about it), then Perforce will still think that you have those files. If you want to get them back, you need to "force sync" the files. In p4v, you can use the "Get Revision..." item and in the subsequent dialog, you can check the "force operation" checkbox to tell Perforce to give you all the files again regardless of whether Perforce thinks that you need them.
Just to complete the information, if you ever do want to remove the files locally, you can do so through p4v by choosing the "Remove from Workspace" item. Doing so will remove the files locally as well as tell perforce that you no longer have those files so that next time you sync, those files will be retrieved from the server.
就像其他人提到的那样,一种解决方案是对整个软件仓库进行“强制同步”,这基本上是将服务器中的所有内容覆盖到本地。这样做的缺点是,如果您在大型仓库上工作,可能需要很长时间才能完成。
另一种选择是将本地工作区与服务器进行比较,然后仅强制同步工作区中缺少的文件。
-sd 选项:仅显示客户端工作区中缺少但存在于软件仓库中的未打开文件的名称。
如果 -sd 不是您需要的,还有更多选项(sa/se/等)可用。请参阅此处。
该命令的积分请访问此博客。
Like other people have mentioned, one solution is to do a "force sync" the entire depot which is basically overwriting everything from server into your local. The downside to this is that it could take a LONG time to finish if you are working on a big depot.
Another alternative is to compare your local workspace with the server, then only force sync the files that are missing from your workspace.
-sd option: Show only the names of unopened files that are missing from the client workspace, but present in the depot.
There are more options (sa/se/etc.) available if -sd is not what you need. see here.
credits for the command goes to this blog.
即使启用“强制操作”,“获取修订”也只会更新未打开(签出)的文件。您应该恢复该工作区中标记为签出的所有文件,然后使用“获取修订”和“强制操作”
"Get Revision" will update only files that are not opened (checked out) even when "Force Operation" is enabled. You should revert all files marked as checked out in that workspace, and then use "Get Revision" with "Force Operation"
它们不会更新,因为根据 Perforce,您的本地计算机上仍然有这些文件。
您需要使用“获取修订...”选项并启用“强制操作”选项。
这将告诉 Perforce 刷新所有文件,甚至是它认为您拥有最新版本的文件。
They won't update because according to Perforce you still have the files on your local machine.
You need to use the "Get Revison..." option and enable the "Force Operation" option.
This will tell Perforce to refresh all the files even those it thinks you have the latest version of.
我按照您的建议进行了操作,但在尝试
从工作空间中删除
时,我不断收到消息称文件仍然打开以进行编辑且无法删除
。此外,
Get Revision
返回一条消息,表示没有更新任何文件
。我最终要做的是
恢复
文件,然后执行获取修订
操作,这解决了问题。I did as you suggested, but I kept getting the message that the files were still
open for edit and cannot be deleted
, when tryingRemove from Workspace
.Also,
Get Revision
returned with a message thatno files were updated
.What I ended up having to do was
Revert
the files, then do theGet Revision
action, that solved the problem.对于遇到这个问题的人来说,这对我在 mac 命令行上有用...
cd 到您的本地 perforce 工作区 - 您正在处理的签出文件的基本目录。
-f 是强制同步。
当您从时间机器备份恢复 Mac 时,这也可以派上用场。
https://www.perforce.com/perforce/r12。 1/manuals/cmdref/sync.html
For people coming into this question, this worked for me on the mac command line ...
cd into your local perforce workspace - the base directory of the checked out files that you are working on.
-f is to force the sync.
This can also come in handy when you restore a mac from a time machine backup.
https://www.perforce.com/perforce/r12.1/manuals/cmdref/sync.html
检查该文件,稍微更改一下,然后恢复。 Perforce 将用最新版本替换本地文件。
Check out the file, change it a little bit and then revert. Perforce will replace the local file with the latest revision.