How to create a new source code branch using TFS API?

后端 未结 1 868
耶瑟儿~
耶瑟儿~ 2021-01-07 01:55

I am trying to create a new branch using the API, and have used both PendBranch() and CreateBranch(). The problem with CreateBranch()

相关标签:
1条回答
  • 2021-01-07 02:58

    In TFS changeset comments are actually editable. Therefore you could try something like the following that makes use of the CreateBranch method introduced in VS2008/TFS2008 SP1:

    public void CreateBranchWithComment(
        string serverUrl, 
        string sourcePath, 
        string targetPath, 
        string comment)
    {
        TeamFoundationServer tfs = new TeamFoundationServer(serverUrl);
        VersionControlServer vcServer = 
            (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
    
        int changesetId = vcServer.CreateBranch(
            sourcePath, 
            targetPath, 
            VersionSpec.Latest);
    
        Changeset changeset = vcServer.GetChangeset(changesetId);
        changeset.Comment = comment;
        changeset.Update();
    
    }
    
    0 讨论(0)
提交回复
热议问题