是否应将用户名和时间戳迁移为变更集? [英] Should the username and timestamp be migrated for changesets?

查看:102
本文介绍了是否应将用户名和时间戳迁移为变更集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpsHub迁移实用程序页面上的以下文本指示用户名和时间戳将嵌入到已迁移的变更集的注释中.

The following text on the OpsHub Migration Utility page indicates that the username and timestamp will be embedded in the comments of the migrated changeset.

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

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

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

Why am I not seeing this metadata embedded in the changeset comments?

推荐答案

该功能已于去年11月移至商业版,我怀疑他们需要更新Visual Studio画廊上的描述以反映该更改.

That feature was moved to the commercial edition last November, I suspect they need to update the description on the visual studio gallery to reflect that change.

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

I have a batch of code you can run on your source server to copy the data into the changeset comment before migration:

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美元.

This will update the source server's changesets and will embed the information prior to migration. That way the data successfully makes it across. I refused to pay $1500 per team project for this functionality.

另请参见

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

新功能矩阵如下:

这篇关于是否应将用户名和时间戳迁移为变更集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆