关于OpsHub Migration Utility page的以下文字表示用户名和时间戳将嵌入到迁移的变更集的注释中。
Metadata information about the source Change set like original username, original check-in timestamp are embedded in Change set comments during migration for Change sets. https://visualstudiogallery.msdn.microsoft.com/28a90a17-d00c-4660-b7ae-42d58315ccf2
为什么我没有在变更集注释中看到此元数据?
最佳答案
该功能已于去年 11 月移至商业版,我怀疑他们需要更新 visual studio gallery 上的描述以反射(reflect)该更改。
我有一批代码,您可以在源服务器上运行,以便在迁移之前将数据复制到变更集注释中:
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 美元。
另见
新的特征矩阵如下:
关于tfs - 是否应该为变更集迁移用户名和时间戳?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36202239/