View 如何将Performce仓库位置转换为客户端视图位置

View 如何将Performce仓库位置转换为客户端视图位置,view,mapping,client,perforce,View,Mapping,Client,Perforce,我想知道如何将Perforce depot位置转换为客户端视图位置,以便编写脚本 我有一个脚本,它首先在perforce中签出一个文件进行编辑,然后与该文件交互。我需要将仓库位置(即.\Projects\Project6)转换为客户端视图位置。(即d:\Projects\Project6) 这可能吗?检查p4 have命令。您给它一个仓库位置或客户机文件名,它给您仓库位置、客户机文件名以及该文件的版本。我将使用p4 fstat命令。我发现它的格式比p4的格式更容易解析。此外,如果使用python

我想知道如何将Perforce depot位置转换为客户端视图位置,以便编写脚本

我有一个脚本,它首先在perforce中签出一个文件进行编辑,然后与该文件交互。我需要将仓库位置(即.\Projects\Project6)转换为客户端视图位置。(即d:\Projects\Project6)


这可能吗?

检查
p4 have
命令。您给它一个仓库位置或客户机文件名,它给您仓库位置、客户机文件名以及该文件的版本。

我将使用p4 fstat命令。我发现它的格式比p4的格式更容易解析。此外,如果使用python编写脚本,则可以使用将返回值编组为python字典


还需要注意的是,您可以键入p4 help commands以查看命令列表及其功能的简短说明。

我一直使用p4 where命令进行此操作。以下是内置帮助中的描述:


performe是最糟糕的。如果您想解析
p4 where
的输出,并且您的文件名中有空格,请参阅-我发现类似
p4 where-T-quack//blah/somefile.txt的东西工作得很好。
quack
部分只是在输出中被引用,但您必须在那里添加一些内容。另外,由于
p4 where
可以为复杂的工作区输出多个结果(请参见下面的使用说明),因此请确保只从输出中选取最后一行(我认为这是安全的)。
where -- Show how file names map through the client view

p4 where [ file ... ]

    Where shows how the named files map through the client view.
    For each argument, three names are produced: the name in the
    depot, the name on the client in Perforce syntax, and the name
    on the client in local syntax.

    If no file is given, the mapping for '...' (all files in the
    current directory and below) is shown.

    Note that 'p4 where' does not determine where any real files are.
    It only computes where they should be according to the client view.