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

2024-03-15

以下文字关于OpsHub 迁移实用程序页面 https://visualstudiogallery.msdn.microsoft.com/28a90a17-d00c-4660-b7ae-42d58315ccf2表示用户名和时间戳将嵌入到迁移的变更集的注释中。

有关源变更集的元数据信息(例如原始用户名、原始签入时间戳)在变更集迁移期间嵌入变更集注释中。https://visualstudiogallery.msdn.microsoft.com/28a90a17-d00c-4660-b7ae-42d58315ccf2 https://visualstudiogallery.msdn.microsoft.com/28a90a17-d00c-4660-b7ae-42d58315ccf2

为什么我没有看到变更集注释中嵌入的元数据?


该功能已于去年 11 月移至商业版,我怀疑他们需要更新视觉工作室画廊上的描述以反映这一变化。

我有一批代码,您可以在源服务器上运行,以便在迁移之前将数据复制到变更集注释中:

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 美元以获得此功能。

See also

  • https://jessehouwing.net/tfs-migration-work-around-pricy-features-of-opshub/ https://jessehouwing.net/tfs-migration-work-around-pricy-features-of-opshub/

新的特征矩阵如下:

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

是否应该迁移变更集的用户名和时间戳? 的相关文章

随机推荐