【问题标题】:Should the username and timestamp be migrated for changesets?是否应该为变更集迁移用户名和时间戳?
【发布时间】:2016-07-12 03:57:07
【问题描述】:
【问题讨论】:
标签:
tfs
azure-devops
opshub
tfvc
【解决方案1】:
该功能已于去年 11 月移至商业版,我怀疑他们需要更新 Visual Studio 库上的说明以反映该更改。
我有一批代码可以在你的源服务器上运行,以便在迁移之前将数据复制到变更集注释中:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
namespace TfsChangesetCommentEnricher
{
class Program
{
static void Main(string[] args)
{
var collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(
new Uri("http://jessehouwing:8080/tfs/defaultcollection"));
var vcs = collection.GetService<VersionControlServer>();
var changes = vcs.QueryHistory(new ItemSpec("$/", RecursionType.Full));
foreach (var change in changes)
{
if (!change.Comment?.Contains("\r\n\r\n-- \r\nOriginally checked-in") ?? true)
{
change.Comment = string.Format(
CultureInfo.InvariantCulture,
@"{0}
--
Originally checked-in
* by: {1} ({2})
* on: {3:u}
* in: {5}
* id: {4}",
change.Comment,
change.Committer,
change.CommitterDisplayName,
change.CreationDate,
change.ChangesetId,
change.VersionControlServer.TeamProjectCollection.Uri);
change.Update();
}
}
}
}
}
这将更新源服务器的变更集,并将在迁移之前嵌入信息。这样,数据就可以成功通过。我拒绝为这个功能为每个团队项目支付 1500 美元。
另见
新的特征矩阵如下: