Should the username and timestamp be migrated for changesets?

故事扮演 提交于 2019-12-10 18:35:04

问题


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.

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?


回答1:


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();
                }
            }
        }
    }
}

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.

See also

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

The new feature matrix is as follows:



来源:https://stackoverflow.com/questions/36202239/should-the-username-and-timestamp-be-migrated-for-changesets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!