Question

there are a lot of questions similar to mine, but none quite touch on what I'm trying to do. I am using SharpSVN to write a simple client which can get specific revisions of each file out of svn to a filepath of my choosing. I've got this working, however I have to specify everything by hand, and I would like it to be more visual.

To do so, I want to make a revision window that can display all of the revision numbers and comments in one view. But, I cannot seem to get the revision number that goes with each log message.

ie:

r3 - log message that goes with r3 - ( maybe even the author )
r2 - log message that goes with r2 - ( maybe even the author )
r1 - log message that goes with r1 - ( maybe even the author )

The snippet below shows kinda how im trying to go about it but info.Revision aways prints the latest revision only.

//SvnUriTarget is a wrapper class for SVN repository URIs
SvnUriTarget target = new SvnUriTarget(tbRepoURI.Text);

//============
Collection<SvnLogEventArgs> logitems = new Collection<SvnLogEventArgs>();

SvnLogArgs arg = new SvnLogArgs();

client.GetLog(new System.Uri(target.ToString()), arg, out logitems);

SvnLogEventArgs logs;
SvnInfoEventArgs info;
client.GetInfo(target.ToString(), out info);
foreach (var logentry in logitems)
{
    MessageBox.Show(info.Revision + ": " + logentry.LogMessage); // only read ..
}
Was it helpful?

Solution

You are reading the Revision from the same place during the foreach loop, that is why it does not change.

The SvnLogEventArgs class that you loop over to get the LogMessage value also has a Revision property, you should use that to get the revision for that log entry instead of getting the revision from the head

so the code might look something like this

//SvnUriTarget is a wrapper class for SVN repository URIs
SvnUriTarget target = new SvnUriTarget(tbRepoURI.Text);

Collection<SvnLogEventArgs> logitems = new Collection<SvnLogEventArgs>();

SvnLogArgs arg = new SvnLogArgs();

client.GetLog(new System.Uri(target.ToString()), arg, out logitems);

foreach (var logentry in logitems)
{
    MessageBox.Show(logentry.Revision + ": " + logentry.LogMessage);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top