How do I get a list of revisions from sharpsvn
4 Answers
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.

- 4,285
- 35
- 50
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.

- 2,720
- 1
- 20
- 27
-
Thank you!It helped me much and answered exactly what I was looking for. – clklachu Mar 17 '11 at 07:30
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()

- 1
- 1

- 19,525
- 4
- 57
- 73
-
1lol, 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
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);
}

- 112
- 2
- 4