如何修复 Perforce 错误“无法破坏可写文件"或 Perforce 错误消息 - Can't Clobber Writable File [英] How to fix Perforce error "Can't clobber writable file" or Perforce Error Message - Can't Clobber Writable File
问题描述
Error: Can't clobber writable file : //file name//
解决方案:当您尝试同步文件时,perforce 预计您在工作区中的文件将具有只读权限.如果文件未检出(通过 p4 edit
)但具有写入权限,则会抛出上述错误.将文件更改为只读并再次同步将解决该问题.或者尝试移除工作区并再次获取最新版本.
Solution: When you try to sync a file, perforce expects your files in workspace will have read-only permissions. If a file is not checked out (by p4 edit
) but has write permission then it will throw the above error. Changing the file to read-only and syncing again will solve the issue. Or try removing the workspace and get the latest revision again.
推荐答案
can't clobber writable"发生文件错误是因为 Perforce 对意外覆盖(破坏")您在工作区中完成的工作非常谨慎.
The "can't clobber writable" file error happens because Perforce is very cautious about accidentally overwriting ("clobbering") work that you've done in your workspace.
正常的 Perforce 工作流程是 p4 同步
一个文件(将它以只读方式放入您的工作区),然后 p4 编辑
如果您想修改它它(这使它可写).使用 p4 edit
打开的文件将始终被 p4 sync
跳过(除非需要安全地安排 resolve
),并且包含在 p4 submit
中.
The normal Perforce workflow is to p4 sync
a file (which puts it into your workspace as read-only) and then to p4 edit
it if you want to modify it (this makes it writable). A file that has been opened with p4 edit
will always be skipped by p4 sync
(except to safely schedule a resolve
if needed), and will be included by a p4 submit
.
如果文件未打开但可写,则表示此工作流程中出现问题,例如您手动使文件可写以对其进行更改,如果 sync
更新此文件,您的更改将丢失!所以 sync
的默认行为是跳过更新可写文件.
If a file is not open, but is writable, it means that something has gone wrong in this workflow, e.g. you manually made the file writable to make changes to it, and if sync
updates this file, your changes will be lost! So the default behavior of sync
is to skip updating writable files.
抛开这个解释,这里有一些选择:
With that explanation out of the way, here are some options:
p4 sync -f FILENAME
将强制更新未打开的文件,无论它是否已过期,以及它是否可写.(仍然跳过打开的文件.)
p4 sync -f FILENAME
will force an unopened file to be updated, whether or not it is out of date, and whether or not it is writable. (Open files are still skipped.)
p4 edit FILENAME
将打开文件.从那里您可以选择 p4 revert
(放弃您的更改)或 p4 submit
(提交您的更改).
p4 edit FILENAME
will open the file. From there your options are p4 revert
(discarding your changes) or p4 submit
(submitting your changes).
在您的客户端规范中将 noclobber
更改为 clobber
会移除防止破坏可写文件的保护措施.
Changing noclobber
to clobber
in your client spec removes safeguards against clobbering writable files.
将 noallwrite
更改为 allwrite
使所有文件默认可写,这隐式删除了 noclobber
保护措施.在当前版本的服务器中,它还启用了安全同步"功能.选项 (p4 sync -s
) 默认情况下,在更新它们之前强制对所有文件进行摘要计算.这比依赖写入位慢,但准确得多.请注意,如果您在不打开文件的情况下处理文件,您仍然面临着没有将它们包含在您的 submit
中的风险——p4 reconcile
命令在这里是您的朋友.
Changing noallwrite
to allwrite
makes all files writable by default, which implicitly removes the noclobber
safeguard. In current versions of the server it also enables the "safe sync" option (p4 sync -s
) by default, forcing digest computations on all files before updating them. This is slower than relying on the write bit, but much more accurate. Note that if you work on files without opening them, you still run the risk of not having them included in your submit
-- the p4 reconcile
command is your friend here.
这篇关于如何修复 Perforce 错误“无法破坏可写文件"或 Perforce 错误消息 - Can't Clobber Writable File的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!