我使用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-如何命令“获取最新修订”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21035685/

10-16 19:50