如何通过 python 获取给定软件仓库路径的 Perforce 文件类型?
How do I get the Perforce file type, of a given depot path, through python?
我有一个内容创建工具,可以在 perforce 中更新文件。
这些文件创建为二进制文件或文本文件时不一致。
我想获取现有 depot 文件的文件类型,以便当用户保存新修订时,它将从工具中导出正确的类型。
总是导出为文本以避免那些 p4 类型文件的文件损坏似乎太老套了。除了更大的文件大小之外,在 perforce 中将文本文件签入为 Binary 是否还有其他问题?
I would like to get the file type of an existing depot file
大多数报告文件的 Perforce 命令都将文件类型作为输出的一部分。最简单的就是p4 files
;如果你 运行 p4 files FILENAME
输出末尾会有一个类似 (text)
的文件类型。
so when the user saves a new revision, it will export the correct type from the tool.
请注意,Perforce 的文件类型与您的工具的文件类型概念不同!对于 Perforce,.PNG
和 .PDF
都只是 binary
.
Aside from larger file sizes, are there other issues with checking in a text file as Binary in perforce?
二进制文件本质上是 "not text" 并且会禁用所有依赖于换行符和文本字符概念的 Perforce 功能——RCS 增量存储是其中之一,但您也不会得到行结束格式转换,diff/merge、p4 annotate
、p4 grep
等。
如果此工具生成的文本文件不可区分或人类可读,并且如果它们不符合本机行结束约定(或者如果它们首先不能跨平台移植) ,那么 binary
听起来像是全面的正确选择。
我有一个内容创建工具,可以在 perforce 中更新文件。 这些文件创建为二进制文件或文本文件时不一致。
我想获取现有 depot 文件的文件类型,以便当用户保存新修订时,它将从工具中导出正确的类型。
总是导出为文本以避免那些 p4 类型文件的文件损坏似乎太老套了。除了更大的文件大小之外,在 perforce 中将文本文件签入为 Binary 是否还有其他问题?
I would like to get the file type of an existing depot file
大多数报告文件的 Perforce 命令都将文件类型作为输出的一部分。最简单的就是p4 files
;如果你 运行 p4 files FILENAME
输出末尾会有一个类似 (text)
的文件类型。
so when the user saves a new revision, it will export the correct type from the tool.
请注意,Perforce 的文件类型与您的工具的文件类型概念不同!对于 Perforce,.PNG
和 .PDF
都只是 binary
.
Aside from larger file sizes, are there other issues with checking in a text file as Binary in perforce?
二进制文件本质上是 "not text" 并且会禁用所有依赖于换行符和文本字符概念的 Perforce 功能——RCS 增量存储是其中之一,但您也不会得到行结束格式转换,diff/merge、p4 annotate
、p4 grep
等。
如果此工具生成的文本文件不可区分或人类可读,并且如果它们不符合本机行结束约定(或者如果它们首先不能跨平台移植) ,那么 binary
听起来像是全面的正确选择。