How to get list of files per revision using SharpSVN

415 Views Asked by At

I would like to get the list of files that were modified, added or removed in a specific revision using sharpsvn. I can get that info using command line, for example:

C:\svn>svn log --verbose -r 123
------------------------------------------------------------------------
r123 | rmercado | 2018-09-26 01:15:18 -0500 (wed., 26 Set. 2018) | 1 line
Changed paths:
   A /branches/folder/file1.txt
   A /branches/folder/file2.txt
   M /branches/folder/file3.txt
   D /branches/folder/file4.txt

changes made to branch
------------------------------------------------------------------------

Thanks for your help,

1

There are 1 best solutions below

0
Shekar Gurram On

Take a look at the below code. ChangedPaths Collection in the instance of SvnLogEventArgs will contain the details of the files changed in commit. In the below code "svnLog.ChangedPaths" contains the details.

Extract from one of my Test application.

            Collection<SvnLogEventArgs> SvnLogList = new Collection<SvnLogEventArgs>();
            SvnRevisionRange range = new SvnRevisionRange(new SvnRevision(this.dtpFromDate.Value), new SvnRevision(this.dtpToDate.Value));
            new SvnClient().GetLog(new Uri(this.txtRepoPath.Text.Trim()), new SvnLogArgs(range), out SvnLogList);

            foreach (SvnLogEventArgs svnLog in SvnLogList)
            {
                CommitLogList.Add(new CommitLog(
                    svnLog.Author,
                    svnLog.LogMessage,
                    svnLog.Revision,
                    svnLog.Time,
                    svnLog.ChangedPaths.Select(cp => cp.Path).ToList()
                    ));
            }