通常我想使用以前的提交评论(并编辑例如一个单词)进行签入。
我习惯了 eclipse,这个功能很好用。
它也可用于 TFS 吗?我还没有找到它(尽管快速的网络搜索),我是瞎了吗?(我目前正在将 TFS 2010 与 VisualStudio 2010 一起使用)
最好的问候, Mayoares
我认为 VS 在这里没有任何帮助(通过更改历史记录剪切和粘贴除外)。
但是,带有 PSCX(PowerShell 社区扩展)和 TFS PowerToys PowerShell 管理单元的小 PowerShell 将执行此操作,当前文件夹设置为解决方案根目录:
(Get-TfsItemHistory . -recurse -stop 1).Comment | Set-Clipboard
将评论放在剪贴板中。在 TFS 中使用 NuGet powershell 会话,这可能会完全自动化(留作练习)。
不要从@Richard 那里拿走为解决方案提供症结所在——我已经赞成他的回答——但这里还有一点要说。
OP 只是有点模棱两可:标题倾向于选择一些最近的提交消息的能力,而正文更建议检索最近的提交消息。理查德完美地解决了后者,但我认为前者也值得评论。
考虑这个函数,它使用了Richard 提到Get-TfsItemHistory
的TFS 2013 Power Tools中的相同函数:
function Get-TfsComment([string]$pattern = ".*", [string]$Path = ".")
{
Get-TfsItemHistory $Path -Recurse | ? { $_.Comment -match $pattern }
}
有了这个尝试:
# Get all comments
Get-TfsComment
# Get 10 latest comments
Get-TfsComment | Select -First 10
# Get all comments containing "bug" and "fix"
Get-TfsComment "bug.*fix"
# Get all comments in your tests folder containing "support"
Get-TfsComment -path .\tests -pattern support
此函数的输出生成Microsoft.TeamFoundation.VersionControl.Client.Changeset对象的集合;它显示的默认属性列表通常是您所需要的:
Changes Owner CreationDa Comment
etId te
------- ----- ---------- -------
1187 MYDOMAIN\fred 3/13/2014 Bug fixes for xyz...
1118 MYDOMAIN\wilma 3/7/2014 New features 139 and 448
1076 MYDOMAIN\barney 2/28/2014 Who remembers this...?
. . .
(请注意,如果将输出通过管道传输到FormatTable -AutoSize
该位置,则会处理列标题中优化不佳的换行。)