tfs - 是否应该为变更集迁移用户名和时间戳?

标签 tfs azure-devops opshub tfvc

关于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 美元。

另见

新的特征矩阵如下:

enter image description here

关于tfs - 是否应该为变更集迁移用户名和时间戳?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36202239/

相关文章:

azure-devops - TFS 到 VS 在线迁移错误 OH-SCM-009 项目不存在

azure-devops - OpsHub TFS 2010 到 Visual Studio Online

tfs - 如何修改 TFS 中工作项的标题?

azure - Azure DevOps 管道构建工件中缺少 Gulp 编译的 CSS 文件夹

tfs - 如何从 TFS 导出源代码以导入 CVS?

azure - 如何在不更改缓存键的情况下删除 Azure Pipeline 缓存

azure - WebJob 从 Azure DevOps Pipeline 部署,但未显示在 WebApp 下

azure-devops - 在 Visual Studio Online 中创建新团队项目时出错

git - 在源代码管理中存储第 3 方 DLL (Azure DevOps/TFS/Git)

tfs - TFS 2010 中的任务截止日期