gpt4 book ai didi

c# - Perforce api - 如何命令 "Get Latest Revision"

转载 作者:太空宇宙 更新时间:2023-11-03 21:37:26 24 4
gpt4 key购买 nike

我使用 Perforce Api (.net c#) 工作。

来源...

//--------Connect--------
Perforce.P4.Server server = new Perforce.P4.Server(new Perforce.P4.ServerAddress("111.222.333.444"));
Perforce.P4.Repository rep = new Perforce.P4.Repository(server);
Perforce.P4.Connection con = rep.Connection;

con.UserName = "PSY";
string password = "gangnamstyle";
con.Client = new Perforce.P4.Client();

Perforce.P4.Options opconnect = new Perforce.P4.Options();
opconnect.Add("-p", password);

con.Connect(opconnect);
con.Login(password);


//--------How to ?--------
string ws_client = @"C:\ClientPath\";
string depot = "//depot/";

Perforce.P4.P4Server p4Server = new Perforce.P4.P4Server(server.Address.Uri, con.UserName, password, ws_client);
Perforce.P4.P4Command com = new Perforce.P4.P4Command(p4Server);



//--------Disconnect---------
con.Disconnect();

此“获取最新版本”的 Perforce 命令

最佳答案

如果您已经在您的机器上设置了 c:\clientPath 的工作区,并假设它的名称为 myWorkspace(如“p4v 中的“工作区”选项卡),然后:

client.Name = "myWorkspace";
client.Initialize(con);
con.Client = client; // otherwise later things fail somewhat mysteriously
con.CommandTimeout = new TimeSpan(0); // otherwise the sync is likely to time out

client.SyncFiles(new Perforce.P4.Options()); // sync everything

关于c# - Perforce api - 如何命令 "Get Latest Revision",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21035685/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com