如何使用TFS API和C#代码通过ChangesetID将当前变更集回滚到特定变更集

时间:2019-02-13 06:58:03

标签: c# tfs rollback

我正在尝试使用Changeset ID从当前变更集回滚到特定变更集,但是什么也没发生

下面是代码...

static TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(repository)); //e.g. repository = "http://..."
static VersionControlServer vcs = tfs.GetService<VersionControlServer>();

Workspace ws = vcs.GetWorkspace(localWorkingPath); // localWorkingPath = @"D:\\Folder_Name";
ws = vcs.GetWorkspace(ws.Name, vcs.AuthorizedUser);

int fromCS = 10674; //changesetid
int toCS = 10672; //changesetid
VersionSpec versionSpecFrom = new ChangesetVersionSpec(fromCS);
VersionSpec versionSpecTo = new ChangesetVersionSpec(toCS);

var status = ws.Rollback(workigDnirectoryArr, RecursionType.None, null, versionSpecFrom, versionSpecTo, LockLevel.None, RollbackOptions.None, null);

enter image description here

0 个答案:

没有答案