获取一组修订的文件

时间:2014-01-26 19:24:04

标签: svn

如何获取SVN中一组修订版本中所有文件的列表?

例如,假设我有这样的更改日志:

Change 1 - File 1 changed
Change 2 - File 2 changed
Change 3 - Some other stuff I don't care about changed
Change 4 - File 3 changed

我希望输出为:

File 1
File 2
File 3

我该怎么做?

编辑:为了澄清,我希望在变更集1,2和4中更改文件,但不包括3.

2 个答案:

答案 0 :(得分:1)

如果您使用的是Windows,则可以使用我的某个开源库中的Get-SvnLog PowerShell cmdlet轻松完成此操作。首先考虑@alroc显示的命令:

svn diff --summarize -r START:END

这完全映射到此PowerShell等效项:

Get-SvnLog -ByFile -RevisionRange START:END

但现在您将输出作为.NET对象。该命令的输出可能如下所示:

Author Rev  Date                   Action Path
------ ---- ----                   ------ ----
ms     1478 8/11/2013 4:00:05 PM   M      /trunk/profile/profile_scripts/NextIT_AgentManifest.ps1
ms     1478 8/11/2013 4:00:05 PM   M      /trunk/profile/profile_scripts/MsBuildTargets.ps1
ms     1478 8/11/2013 4:00:05 PM   M      /trunk/profile/profile_scripts/VsCommandPrompt.ps1
ms     1478 8/11/2013 4:00:05 PM   M      /trunk/profile/profile_scripts/EventLogByTime.ps1
ms     1478 8/11/2013 4:00:05 PM   M      /trunk/profile/profile_scripts/EventLogTail.ps1
ms     1479 8/11/2013 4:02:48 PM   M      /trunk/profile/Microsoft.PowerShell_profile.ps1
ms     1480 8/12/2013 7:45:59 PM   M      /trunk/CleanCode/FileTools/GetChildItemExtension.ps1
ms     1481 10/13/2013 1:05:04 AM  M      /trunk/scripts/SystemInfo.ps1
ms     1482 10/13/2013 1:05:51 AM  M      /trunk/CleanCode/DocTreeGenerator/DocTreeGenerator.psm1
ms     1482 10/13/2013 1:05:51 AM  M      /trunk/scripts/MeasureSimpleTalkArticles.ps1
ms     1483 10/13/2013 4:56:47 PM  M      /trunk/CleanCode/FileTools/Select-StringAligned.ps1
ms     1484 11/15/2013 10:46:15 AM M      /trunk/scripts/SystemInfo.ps1
ms     1484 11/15/2013 10:46:15 AM M      /trunk/scripts/RunSystemInfo.ps1
ms     1486 11/19/2013 9:07:59 PM  M      /trunk/CleanCode/DocTreeGenerator/DocTreeGenerator.psd1

因此,通过包含过滤是微不足道的......

Get-SvnLog -ByFile -RevisionRange 1478:1486 |
? { $_.Revision -in (1478, 1482, 1484) } | Format-Table -auto

......或排除:

Get-SvnLog -ByFile -RevisionRange 1478:1486 |
? { $_.Revision -notin (1478, 1482, 1484) } | Format-Table -auto

查看Get-SvnLog的API页面(转到我的bookshelf然后转到PowerShell然后转到svn工具)以获取更多示例以激发您的想象力。可以下载该库here

答案 1 :(得分:0)

svn diff --summarize -r START:END将列出该范围内更改的所有唯一路径。