簡體   English   中英

如何將文件簽出到默認更改列表?

[英]How to Checkout file to Default ChangeList?

這是我想將文件簽出到默認更改列表的代碼。

但我不知道我的默認 changlist ID。 我怎么才能得到它?

在此處輸入圖像描述

string command = "-c";
string f = filePath;

cmd = new P4Command(p4, "add", true, command, changelist.Id.ToString(), "-f", f);
rslt = cmd.Run();

f = filePath.Replace("@", "%40");

cmd = new P4Command(p4, "edit", true, command, changelist.Id.ToString(), f);
rslt = cmd.Run();

cmd = new P4Command(p4, "reopen", true, command, changelist.Id.ToString(), f);
rslt = cmd.Run();

無需使事情過於復雜——它被稱為“默認值”,因為當您不指定更改列表時,它實際上是默認值。 “默認變更列表”並不是真正的變更列表; 它只是在您的客戶端上打開的不屬於編號更改列表的文件的集合。

C:\Perforce\test>p4 edit foo
//stream/main/foo#4 - opened for edit

C:\Perforce\test>p4 opened
//stream/main/foo#4 - edit default change (text)

我認為就您的代碼而言,這是:

cmd = new P4Command(p4, "edit", true, f);
rslt = cmd.Run();

只需去掉“-c”(代表“更改列表”)和更改列表編號即可。

如果您需要將文件從編號更改中移出並進入默認更改,您可以使用reopen命令,如p4 help reopen中所述:

    reopen -- Change the filetype of an open file or move it to
              another changelist

    p4 reopen [-c changelist#] [-t filetype] file ...

        ...

        The target changelist must exist; you cannot create a changelist by
        reopening a file. To move a file to the default changelist, use
        'p4 reopen -c default'.

我想我找到了答案。 不要輸入changeId,只需輸入關鍵字:“default”這樣。

string command = "-c";
cmd = new P4Command(p4, "add", true, command, "default", "-f", f);
cmd = new P4Command(p4, "edit", true, command, "default", f);
cmd = new P4Command(p4, "reopen", true, command, "default", f);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM