我在多个分支下的 P4 服务器上有文件,例如
//depot/branch1/file.txt
//depot/branch2/file.txt
//depot/branch3/file.txt
假设 file.txt 是同一个文件但不同的分支
当我使用命令行时
p4 -c testWorkspace where somepath\file.txt
我得到以下结果
-//depot/branch1/file.txt {client path depot path}
-//depot/branch2/file.txt {client path depot path}
//depot/branch3/file.txt {client path depot path}
从那我可以看出客户端testWorkspace中的file.txt应该通过branch3访问(所以从这个仓库路径我会得到FileSpec、元数据、编辑等
但是当我尝试通过 P4api.net 做同样的事情并使用
Client.GetClientFileMappings("somepath\file.txt")
或者
P4Command cmd3 = new P4Command(con, "where", true, "somepath\file.txt");
P4CommandResult result3 = cmd3.Run();
我得到了类似的结果,但没有前导减号(破折号 - )符号
//depot/branch1/file.txt {client path depot path}
//depot/branch2/file.txt {client path depot path}
//depot/branch3/file.txt {client path depot path}
而且我不知道我在这里做错了什么。
我需要的是获取给定工作空间的当前文件属于哪个分支的信息,或者更好地获取其正确的 FileSpec,以便我可以使用 MoveFile、Add 等。但我只获得所有分支的路径,并且可以识别它属于当前工作区的哪个分支