获取文件的状态(工作中、挂起、同步中)

Get the state of the file(in work, pending, synced)

是否有直接命令可以比较工作区文件和软件仓库文件以及return文件的状态?

例如
p4 fstat D:/path/my_file.txt => inwork
p4 fstat D:/path/my_file.txt => up-to-date

听起来您正在寻找 p4 diff-s 标志,我一直记得它是 'summary' 标志。

https://www.perforce.com/perforce/r17.1/manuals/cmdref/Content/CmdRef/p4_diff.html

例如,p4 diff -sa:仅显示与软件仓库中的修订版本不同或丢失的已打开文件的名称。

这个问题有点不清楚,因为您没有定义 "state" 的确切含义 -- p4 fstat 命令 returns 有很多关于文件状态的信息,听起来你想要其中的一些子集,但你没有指定是什么。

也就是说,我猜您可能会喜欢 p4 status 命令。

https://www.perforce.com/perforce/r16.2/manuals/cmdref/p4_status.html

这将告诉您当前打开的文件以及已修改但未打开的文件。

回答改写的问题:

Is there a direct command that can compare the workspace file with the depot file and return the state of the file?

p4 diff -f [filename] 将强制进行比较 (diff),无论文件是否打开。