gpt4 book ai didi

encoding - 如何在 Perforce 中处理文件类型更改?

转载 作者:行者123 更新时间:2023-12-02 22:10:38 25 4
gpt4 key购买 nike

当您将文件添加到 Perforce 时,它​​会尝试确定文件的类型(文本、二进制、utf16 等)。它在这方面做得很好,但显然在初次提交到版本控制后不再检查文件类型。一位同事最近对一个文本文件进行了更改,将其转换为 Unicode (utf16)。 Perforce 无法识别这一点,并且仍然认为它是文本类型,因此当其他人检索该文件时,它已损坏。

我们通过重新提交文件并显式将文件类型更改为 utf16 解决了该问题,但我们更希望这种情况自动发生。有一些方法可以强制它始终使用某种编码类型,但我不知道我是否喜欢这个想法。有没有人处理过这个问题并找到解决方案?

最佳答案

Perforce 技术支持这样说:

Perforce does not check the content of the file when you submit an edit.

Checking every single file edit for content is potentially very expensive. "text" and "utf16" are not the only file types to look out for, a file could potentially change type from "text" to "binary" for example.

Another problem is that sometimes a user wants to override the default behavior of how Perforce recognizes a file. How should the server react in this case if the actual file type does not match the file type the user provides?

For these reasons Perforce will only determine the file type when the file is added, and take the "typemap" and the command parameter "-t" into account.

On the other hand, you can prevent your situation from happening again by employing a "change-content" trigger. This trigger would check the content of the file and compare it to the specified file type, rejecting any submit that creates a mismatch.

关于encoding - 如何在 Perforce 中处理文件类型更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/265763/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com