デポに 2 つの支店があります。
//depot/project/mainline/...
//depot/project/staging/...
プロジェクトのビルドを管理する社内ツールを使用しており、すべてのファイルをメインラインからステージングに自動的にプロモートするビルド ステップを作成したいと考えています。次の例に従って、p4.net APIを使用して記述しようとしています. ビルド ツールから powershell コマンドを実行できます。私の計画は、ac# コンソール アプリケーションを作成し、ツールを使用してコンパイルし、ビルド ステップとして実行することでした。残念ながら、私はその例ではどこにも行きません。クライアントを作成し、ブランチ仕様を作成し、ファイルを同期することさえできますが、統合を送信する方法を一生理解できません。解決策の考えを過度に設計しようとしているように感じます。これは簡単にできるはずです。壊れたコードを以下に添付します。それが意味をなさない場合、それは試行錯誤を使用して物事を把握しており、まだ最終的なパスを作成していないためです. そうは言っても、p4 APIを使用する必要がなければ、なおさらです。唯一の要件は、コマンドを実行するために必要なユーザー入力がないことです。マージ競合が発生した場合、
ありがとう
string uri = "server";
string user = "user";
string pass = null;
string ws_client = "Project-Temp-"+ Guid.NewGuid().ToString();
Server server = new Server(new ServerAddress(uri));
Repository rep = new Repository(server);
Connection con = rep.Connection;
con.UserName = user;
con.Client = new Client();
con.Client.Name = ws_client;
con.Client.ViewMap = new ViewMap();
con.Connect(null);
Credential cred = con.Login(pass, null, null);
rep.DeleteClient(con.Client, null);
rep.CreateClient(con.Client);
con.Client.ViewMap.Clear();
con.Client.ViewMap.Add("//depot/project/...", String.Format("//{0}/...", con.Client.Name), MapType.Include);
rep.UpdateClient(con.Client);
var files = con.Client.SyncFiles(new SyncFilesCmdOptions(SyncFilesCmdFlags.None, -1));
ViewMap vm = new ViewMap();
vm.Add(new MapEntry(MapType.Include,new ClientPath("//depot/project/mainline/..."), new ClientPath("//depot/project/staging/...")));
string msg = "Mainline to Staging";
BranchSpec bs = new BranchSpec("Project-Temp", user, DateTime.Now, DateTime.Now, msg, true, vm, null, null);
int change = -1;
IntegrateFilesCmdOptions BranchOptions = new IntegrateFilesCmdOptions(IntegrateFilesCmdFlags.None, change, -1, "Project-Temp", null, null);
rep.CreateBranchSpec(bs);
rep.UpdateClient(con.Client);
var integrated = con.Client.IntegrateFiles(BranchOptions);
con.Client.ResolveFiles(files, new ResolveCmdOptions(ResolveFilesCmdFlags.AutomaticYoursMode, change));
rep.DeleteClient(con.Client, null);