9

I'd like to know how to convert Perforce depot locations to client view locations for the purpose of script writing.

I have a script that first checks out a file for edit in perforce and then interacts with the file. I need to have the depot location (i.e. \Projects\Project6) converted to the client view location. (i.e. d:\Projects\Project6).

Is this possible?

4

3 回答 3

11

我一直为此使用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.
于 2008-11-19T01:41:47.370 回答
4

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

还需要注意的是,您可以键入p4 help 命令来查看命令列表和它们的作用的简短描述。

于 2008-11-19T01:34:28.290 回答
2

Check out the p4 have command. You give it either a depot location or a client filename and it gives you the depot location, client filename, and what version of that file you have.

于 2008-11-19T00:49:48.847 回答