ConditionRacer
ConditionRacer

Reputation: 4498

Get files changed for a set of revisions

How do I get a list of all files changed over a set of revisions in SVN?

For example, say I have a change log like this:

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

I want the output to be:

File 1
File 2
File 3

How can I do this?

Edit: To clarify, I want the files changed in changesets 1,2, and 4, but excluding 3.

Upvotes: 0

Views: 376

Answers (2)

Michael Sorens
Michael Sorens

Reputation: 36758

If you are on Windows you can do this easily with the Get-SvnLog PowerShell cmdlet from one of my open-source libraries. Consider first the command that @alroc showed:

svn diff --summarize -r START:END

That maps exactly to this PowerShell equivalent:

Get-SvnLog -ByFile -RevisionRange START:END

But now you have the output as .NET objects. The output of that command might look like this:

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

So it is then trivial to filter by inclusion...

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

... or by exclusion:

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

Take a look at the API page for Get-SvnLog (go to my bookshelf then PowerShell then svn tools) for many more examples to spur your imagination. The library may be downloaded here.

Upvotes: 1

alroc
alroc

Reputation: 28194

svn diff --summarize -r START:END will list all unique paths changed in that range.

Upvotes: 0

Related Questions