How to get list of changed files in SharpSVN (like svn diff --summarize --xml)
Asked Answered
C

2

6

I'm trying to get a list of changed files from SharpSVN. I can get the data I need on the command line like this:

svn diff -r <startrev>:HEAD --summarize --xml

Can somebody point me to the right spot in the SharpSVN maze to replicate this? Ideally, I'd be able to get a collection of the changed files out, but I can parse a stream if needs be.

Coenobite answered 17/3, 2012 at 0:42 Comment(0)
A
4

The SharpSvn equivalent of svn diff --summarize is SvnClient.DiffSummary().

You can use it as

using (var client = new SvnClient())
{
   var location = new Uri("http://my.example/repos/trunk");
   client.DiffSummary(new SvnUriTarget(location, 12), new SvnUriTarget(location, SvnRevision.Head),
                      delegate(object sender, SvnDiffSummaryEventArgs e)
                      {
                        // TODO: Handle result
                      });
}

when you want the results as they come in.

Or you can use .GetDiffSummary() if you want to access the final result as a list.

Antiknock answered 18/10, 2012 at 14:54 Comment(1)
Note that Subversion -1.7 only supports Uri targets for summarizing. It looks like this limitation will be lifted in 1.8.Antiknock
N
2

there is simplest way to do that but here is some different approch :

with sharpsvn use the Status command to retrive the all files status in both WorkingCopy and Repository Status and then compare between them

example :

using (SvnClient cl = new SvnClient())
  cl.Status(YourPath, new SvnStatusArgs {
    Depth = SvnDepth.Infinity, ThrowOnError = true,
    RetrieveRemoteStatus = true, Revision = SvnRevision.Head}, 
    new EventHandler<SvnStatusEventArgs>(
       delegate(object s, SvnStatusEventArgs e) {
          switch (e.LocalContentStatus) {
             case SvnStatus.Normal:break;
             case SvnStatus.None: break;
             case SvnStatus.NotVersioned: break;
             case SvnStatus.Added:break;
             case SvnStatus.Missing: break;
             case SvnStatus.Modified: break;
             case SvnStatus.Conflicted: break;
             default: break;
          }
          switch (e.RemoteContentStatus) {
             case SvnStatus.Normal:break;
             case SvnStatus.None: break;
             case SvnStatus.NotVersioned: break;
             case SvnStatus.Added:break;
             case SvnStatus.Missing: break;
             case SvnStatus.Modified: break;
             case SvnStatus.Conflicted: break;
             default: break;
          }
       }));
Necrolatry answered 16/4, 2012 at 19:45 Comment(1)
svn diff --summarize invoked this way compares two urls at specific revisions. Status compares the working copy to a specific revision.Antiknock

© 2022 - 2024 — McMap. All rights reserved.