How to fix Perforce error “Can't clobber writable file” or Perforce Error Message - Can't Clobber Writable File

妖精的绣舞 提交于 2020-02-20 06:40:08

问题


Error: Can't clobber writable file : //file name//

Solution: When you try to sync a file, perforce expects your files in workspace will have read-only permissions. But if a file is not checkout,(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.


回答1:


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.

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.

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:

  1. p4 sync -f 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.)

  2. p4 edit will open the file. From there your options are p4 revert (discarding your changes) or p4 submit (submitting your changes).

  3. Changing noclobber to clobber in your client spec removes safeguards against clobbering writable files.

  4. 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.



来源:https://stackoverflow.com/questions/48315647/how-to-fix-perforce-error-cant-clobber-writable-file-or-perforce-error-messag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!