如何将TFS签到笔记限制为自定义路径?

时间:2022-07-01 22:35:43

You can limit "Check-In Policy" rules via the "Custom Paths" policy. But the "Check-in Notes" tab doesn't seem to fit in to the same system. Why isn't "Check-In notes" just another "Check-In policy"??

您可以通过“自定义路径”策略限制“签入策略”规则。但“签入备注”选项卡似乎不适合同一系统。为什么“Check-In notes”不是另一个“登记政策”?

I'm using Team Foundation Server 2008 SP1

我正在使用Team Foundation Server 2008 SP1

2 个解决方案

#1


3  

We had a similar problem some time ago. For some sub tree we wanted to require entering a code reviewer. I ended up implementing a custom policy and used the Custom Path Policy to restrict it to certain folders. That works well, except that you have to deploy your policy assembly and TFS has no built-in mechanism for that, yet.

我们前一段时间遇到过类似的问题。对于某些子树,我们要求输入代码审阅者。我最终实现了自定义策略,并使用自定义路径策略将其限制为某些文件夹。这很有效,除了您必须部署策略程序集,而TFS没有内置机制。

#2


2  

That's an interesting question - the short answer is you cannot.

这是一个有趣的问题 - 简短的回答是你不能。

I have ran into the issue myself a lot where people get check-in notes and check-in policies confused because, while very different in implementation on the server, they often serve similar purposes.

我自己遇到了很多问题,因为人们在办理登记手续和签到政策时感到困惑,因为虽然服务器上的实施方式有很大差异,但它们通常用于类似的目的。

Check-in notes are bits of structured meta-data that you want to collect on every check-in to a Team Project. They can be thinks like who was the code reviewer or a reference to a ticket in an external CRM system or something. You can make them required, or just have them defined for people to optionally fill out.

签到笔记是您希望在每次签到Team Project时收集的结构化元数据。他们可以认为谁是代码审查员或对外部CRM系统中的票证的引用。您可以将它们变为必需,或者只是为人们定义它们以便可选择填写。

Check-in policies are bits of code that run on the client at the point of check-in that get a say if the check-in should be allowed or not. These are useful for checking things like you have associated a check-in with a work item, given it a comment or the code you are check-in in passes certain key static code analysis rules (such as basic checking for SQL injection attacks etc). If a check-in policy fails in the evaluation of the check-in then the user gets alerted and they get the ability to fix the problem or check-in anyway with a check-in policy override than can easily be reported on or alerted for by the TFS administrator.

签到策略是在签到时在客户端上运行的代码位,如果允许签入,则可以说明。这些对于检查诸如您是否已将工作项签入关联,给定注释或您签入的代码传递某些关键静态代码分析规则(例如SQL注入攻击的基本检查等)非常有用。 。如果在签到评估时签到策略失败,则用户会收到警报,并且无论如何都可以使用签到策略覆盖来解决问题或签到,而不是可以轻松报告或提醒由TFS管理员。

Both check-in notes and check-in policies are defined and scoped at the Team Project level. However, Microsoft got feedback that some people would like check-in policies would like to be applied to specific paths in version control rather than just the Team Project and so the Custom Path Policy was invented.

签入备注和签到策略都在团队项目级别定义和确定范围。但是,微软得到的反馈是,有些人希望签到策略希望应用于版本控制中的特定路径而不仅仅是团队项目,因此发明了自定义路径策略。

The Custom Path Policy is a bit of a hack that allows you to wrap check-in policies inside the custom path policy. The custom path gets evaluated on every check-in and if it contains files inside the defined path then the wrapped check-in policies are evaluated for those files. The Custom Path Policy ships in the TFS Power Tools and is not part of the "Out The Box" TFS experience.

自定义路径策略有点像黑客攻击,允许您在自定义路径策略中包含签入策略。每次签入时都会评估自定义路径,如果它包含定义路径中的文件,则会针对这些文件评估包装的签入策略。自定义路径策略附带在TFS Power Tools中,不属于“Out The Box”TFS体验。

So, to answer your question a different way - I suspect the answer is "because that's the way it was designed and not enough people have asked for it to be changed".

所以,以不同的方式回答你的问题 - 我怀疑答案是“因为它的设计方式并没有足够的人要求改变它”。

If you wanted to leave feedback at http://connect.microsoft.com/VisualStudio I know they take customer feedback very seriously.

如果您想在http://connect.microsoft.com/VisualStudio上留下反馈,我知道他们非常重视客户反馈。

#1


3  

We had a similar problem some time ago. For some sub tree we wanted to require entering a code reviewer. I ended up implementing a custom policy and used the Custom Path Policy to restrict it to certain folders. That works well, except that you have to deploy your policy assembly and TFS has no built-in mechanism for that, yet.

我们前一段时间遇到过类似的问题。对于某些子树,我们要求输入代码审阅者。我最终实现了自定义策略,并使用自定义路径策略将其限制为某些文件夹。这很有效,除了您必须部署策略程序集,而TFS没有内置机制。

#2


2  

That's an interesting question - the short answer is you cannot.

这是一个有趣的问题 - 简短的回答是你不能。

I have ran into the issue myself a lot where people get check-in notes and check-in policies confused because, while very different in implementation on the server, they often serve similar purposes.

我自己遇到了很多问题,因为人们在办理登记手续和签到政策时感到困惑,因为虽然服务器上的实施方式有很大差异,但它们通常用于类似的目的。

Check-in notes are bits of structured meta-data that you want to collect on every check-in to a Team Project. They can be thinks like who was the code reviewer or a reference to a ticket in an external CRM system or something. You can make them required, or just have them defined for people to optionally fill out.

签到笔记是您希望在每次签到Team Project时收集的结构化元数据。他们可以认为谁是代码审查员或对外部CRM系统中的票证的引用。您可以将它们变为必需,或者只是为人们定义它们以便可选择填写。

Check-in policies are bits of code that run on the client at the point of check-in that get a say if the check-in should be allowed or not. These are useful for checking things like you have associated a check-in with a work item, given it a comment or the code you are check-in in passes certain key static code analysis rules (such as basic checking for SQL injection attacks etc). If a check-in policy fails in the evaluation of the check-in then the user gets alerted and they get the ability to fix the problem or check-in anyway with a check-in policy override than can easily be reported on or alerted for by the TFS administrator.

签到策略是在签到时在客户端上运行的代码位,如果允许签入,则可以说明。这些对于检查诸如您是否已将工作项签入关联,给定注释或您签入的代码传递某些关键静态代码分析规则(例如SQL注入攻击的基本检查等)非常有用。 。如果在签到评估时签到策略失败,则用户会收到警报,并且无论如何都可以使用签到策略覆盖来解决问题或签到,而不是可以轻松报告或提醒由TFS管理员。

Both check-in notes and check-in policies are defined and scoped at the Team Project level. However, Microsoft got feedback that some people would like check-in policies would like to be applied to specific paths in version control rather than just the Team Project and so the Custom Path Policy was invented.

签入备注和签到策略都在团队项目级别定义和确定范围。但是,微软得到的反馈是,有些人希望签到策略希望应用于版本控制中的特定路径而不仅仅是团队项目,因此发明了自定义路径策略。

The Custom Path Policy is a bit of a hack that allows you to wrap check-in policies inside the custom path policy. The custom path gets evaluated on every check-in and if it contains files inside the defined path then the wrapped check-in policies are evaluated for those files. The Custom Path Policy ships in the TFS Power Tools and is not part of the "Out The Box" TFS experience.

自定义路径策略有点像黑客攻击,允许您在自定义路径策略中包含签入策略。每次签入时都会评估自定义路径,如果它包含定义路径中的文件,则会针对这些文件评估包装的签入策略。自定义路径策略附带在TFS Power Tools中,不属于“Out The Box”TFS体验。

So, to answer your question a different way - I suspect the answer is "because that's the way it was designed and not enough people have asked for it to be changed".

所以,以不同的方式回答你的问题 - 我怀疑答案是“因为它的设计方式并没有足够的人要求改变它”。

If you wanted to leave feedback at http://connect.microsoft.com/VisualStudio I know they take customer feedback very seriously.

如果您想在http://connect.microsoft.com/VisualStudio上留下反馈,我知道他们非常重视客户反馈。