修改TFS变更集的CreationDate [英] Modify CreationDate for TFS Changeset

查看:111
本文介绍了修改TFS变更集的CreationDate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在创建从一个版本控制系统到TFS的迁移工具,并且正在使用Microsoft.TeamFoundation.Client程序集,并且遇到了问题.我可以模拟每个Changeset的更改,但是CreationDate属性由CheckIn方法自动生成,如下所示:

I'm currently creating a migration tool from one version control system to TFS and am using the Microsoft.TeamFoundation.Client assembly and have run into a problem. I am able to mimic the changes for each Changeset, but the CreationDate property is automatically generated by the CheckIn method as shown below:

var changeSetId = workspace.CheckIn(pendingChanges, userName, comment, note, null, null);

然后,我可以通过CheckIn方法返回的ID加载Changeset对象:

I am then able to load the Changeset object by ID that was returned by the CheckIn method:

var changeSet = workspace.VersionControlServer.GetChangeset(changeSetId);

我正在尝试在Changeset中设置CreationDate(非只读),并且可以通过以下代码进行操作:

I am attempting to set the CreationDate (not readonly) in the Changeset and I am able to do that via the following code:

changeSet.CreationDate = legacyLog.Date;
changeSet.Update();

但是,在调用Update方法之后,所做的更改未保存在服务器上,因为我试图在浏览器中验证日期,并且仍然将今天的日期显示为CreationDate(除非我误解了该日期会显示/显示).有没有人试图将CreationDate更改为Changeset,还是我要解决所有这些错误?

But, after calling the Update method, the changes are not saved on the server as I have attempted to verify the date in the browser and it still shows today's date as the CreationDate (unless I'm misunderstanding where that date is displayed/rendered). Has anyone attempted to change the CreationDate for a Changeset before or am I going about this all wrong?

推荐答案

我同意DaveShaw的观点,您需要直接在TFS数据库中修改变更集的签入时间. SQL语句:UPDATE tbl_Changeset SET CreationDate ='?'在哪里ChangeSetId ='?'

I agree with DaveShaw, you need to directly modify changeset's check-in time in TFS database. SQL statement: UPDATE tbl_Changeset SET CreationDate='?' WHERE ChangeSetId='?'

请查看此链接上的ModifyCheckinDate2012源代码以获取详细信息: https://tfsprod.codeplex.com /SourceControl/latest

Please check the ModifyCheckinDate2012 source code on this link for the details: https://tfsprod.codeplex.com/SourceControl/latest

但是,请注意,不建议直接在TFS数据库中进行修改,因为这可能会带来一些潜在的风险.

However, be note that it is not recommended to modify directly in TFS database, as this may bring some potential risks.

这篇关于修改TFS变更集的CreationDate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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