2

How do I get a list of revisions from sharpsvn

Chris Meek
  • 5,720
  • 9
  • 35
  • 44

4 Answers4

7

If you look at the metadata for SvnLogEventArgs (which is returned as a collection from GetLog) it derives from SvnLoggingEventArgs, which has properties of Author, Revision, Time and LogMessage (amongst others)

Each SvnLogEventArgs item has a collection of ChangedPaths, which have properties for SvnChangeAction, and Path.

Luke Duddridge
  • 4,285
  • 35
  • 50
4

You can get a list of all the log info by this method:

var client = new SvnClient();

System.Collections.ObjectModel.Collection<SvnLogEventArgs> logEventArgs;

client.GetLog("targetPath", out logEventArgs);

Iterating through all the logEventArgs will give you some useful information - LogMessage, Author, etc.


I don't know what you're doing, but I am checking the latest version of the working copy using SvnWorkingCopyClient:

var workingCopyClient = new SvnWorkingCopyClient();

SvnWorkingCopyVersion version;

workingCopyClient.GetVersion(workingFolder, out version);

The latest version of the local working repository is then available through

long localRev = version.End;

For a remote repository, use

 var client = new SvnClient();

 SvnInfoEventArgs info;

 client.GetInfo(targetUri, out info);

 long remoteRev = info.Revision;

instead.

This is similar to using the svnversion tool from the command line. Hope this helps.

CJBrew
  • 2,720
  • 1
  • 20
  • 27
2

Guessing at what your question really is about the answer is most likely SvnClient.Log(), to get you a list of changes of a path.

Another anwer would be:

for (int i = 1; i < 101; i++)
  yield return i;

to get you the first 100 revisisions of a repository ;-)

See Using SharpSvn to retrieve log entries within a date range for some examples on how to use SvnClient.Log()

Community
  • 1
  • 1
Bert Huijben
  • 19,525
  • 4
  • 57
  • 73
  • 1
    lol, fair enough. I gues what I'm after is the meta for a revision, the commit comment, which files were changed etc – Chris Meek May 26 '10 at 08:59
0

This is the code form which you can get all the revisions no in list revisions numbers. UriSCpath will be uri for svn path.

 SvnTarget tr = SvnTarget.FromUri(UriSCPath);
                Collection<SvnLogEventArgs> logEventArgs;
                List<Int64> revisionNumbers = new List<Int64>();
                SvnLogArgs logArgs = new SvnLogArgs();
                DPISVN_Clnt.GetLog(UriSCPath, logArgs, out logEventArgs);

                Int64 latestReision = logEventArgs[0].Revision;

                foreach (var item in logEventArgs)
                {
                        revisionNumbers.Add(item.Revision);

                }
vzades
  • 112
  • 2
  • 4