首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将文件签出到默认ChangeList?

如何将文件签出到默认ChangeList?
EN

Stack Overflow用户
提问于 2020-04-15 13:48:18
回答 2查看 292关注 0票数 1

这是我的代码,我想把文件签出到默认的更改列表。

但我不知道我的默认更改列表ID。我如何获取它?

代码语言:javascript
复制
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();
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-04-15 14:46:18

不需要把事情搞得过于复杂--它被称为“默认”,因为当您没有指定更改列表时,它实际上就是默认的。“默认更改列表”并不是真正的更改列表;它只是在您的客户端上打开的文件的集合,这些文件还不属于编号的更改列表。

代码语言:javascript
复制
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)

我认为就您的代码而言,这是:

代码语言:javascript
复制
cmd = new P4Command(p4, "edit", true, f);
rslt = cmd.Run();

只需去掉"-c“(代表" changelist ")和changelist编号即可。

如果需要将文件从编号更改移到缺省更改中,可以使用p4 help reopen中所述的reopen命令

代码语言:javascript
复制
    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'.
票数 2
EN

Stack Overflow用户

发布于 2020-04-15 14:12:34

我想我找到答案了。不要输入默认,只需输入关键字:“changeId”,如下所示。

代码语言:javascript
复制
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);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61222118

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档