c# - How to create a branch of TFS and copy the details of one branch to another branch -
scenario want copy of main branch details feature or release branch if pass path parameter in console application
string uri ="http://portnumber0/tfs/dev"; connectbycredentialsprovider connect = new connectbycredentialsprovider(); icredentials icred = new networkcredential(@"username", "pwd"); connect.getcredentials(new uri(uri), icred); tfsteamprojectcollection tfsconnect = new tfsteamprojectcollection(new uri(uri), connect); tfsconnect.ensureauthenticated(); versioncontrolserver versioncontrol = (versioncontrolserver)tfsconnect.getservice(typeof(versioncontrolserver)); string sourcepath = "$/project/main"; string destinationpath = "$/project/features"; versioncontrol.createbranchobject(new branchproperties (new itemidentifier(sourcepath))); int changesetid = versioncontrol.createbranch( sourcepath, destinationpath, versionspec.latest); changeset changeset = versioncontrol.getchangeset(changesetid); changeset.update();
Comments
Post a Comment