tags:

views:

180

answers:

3

How do I get a list of revisions from sharpsvn

+1  A: 

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 http://stackoverflow.com/questions/989034/using-sharpsvn-to-retrieve-log-entries-within-a-date-range for some examples on how to use SvnClient.Log()

Bert Huijben
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
+1  A: 

Hello Chris,

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
A: 

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