修改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.