如何解析 Perforce “pickle”二进制输出?
Perforce 命令行有一个特殊的开关 -G,据说可以使用 python 的“pickle”序列化格式使其输出成为机器可读的。一般来说,情况确实如此吗?
例如,考虑 p4 -G diff -duw3
我是否遗漏了某些内容,或者这种“机器可读”格式实际上不是机器可读的?如何在其输出中找到泡菜和原始差异之间的界限?
Perforce command line has a special switch, -G, that supposedly causes its output to be machine readable, using python's "pickle" serialization format. Is this actually so, in general?
For example, consider the output of p4 -G diff -duw3 <file1> <file2> <file3>
. The output, as far as I can tell, is a sequence of: pickle, raw diff, pickle, raw diff, pickle, raw diff. It does not appear to contain any delimiters that would enable one to reliably locate the pickle/diff boundaries.
Am I missing something or is this "machine-readable" format not actually machine-readable? How can I find the boundaries between pickles and raw diffs in its output?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
p4 -G
以编组格式(未腌制)输出其数据。但你是对的 -
p4 -G diff -duw3
也不会取消marshal
,所以我猜那里有问题。不过,
p4 -G opening
解组效果很好。然而任何类型的diff
都会失败。以下是相关知识库文章:http://kb.perforce.com/ToolsScripts/PerforceUtilities/UsingP4G
p4 -G
outputs its data inmarshal
ed form not pickled.But you are right -
p4 -G diff -duw3
also won't unmarshal
, so I guess there is a problem there.p4 -G opened
unmarshals fine though. However any kind ofdiff
fails.Here is a relevant knowledge base article: http://kb.perforce.com/ToolsScripts/PerforceUtilities/UsingP4G