Search code examples
c#childrensharpsvnrevisions

How do you obtain a SvnLogEventArgs childs revision number in SharpSVN?


I have been working with SharpSVN quite a bit lately and I'm currently trying to obtain all of a revisions children's revision numbers. I see that using SvnLogEventArgs.HasChildren I can verify that they exist but it need the actual numbers of the children below it. I've been looking at the SvnClient object and see a GetMergesMerged() but an unable to determine what to feed it to return it the correct values, right now it does not return anything.

System.Collections.ObjectModel.Collection<SvnMergesMergedEventArgs> logitems = null;
SvnTarget target = SvnTarget.FromUri(new Uri(myRepoURL));
SvnUriTarget targetUri = new SvnUriTarget(new Uri(myRepoURL), revision);
client.GetMergesMerged(target, targetUri, out logitems);

This is what I currently use but is not returning anything, if someone could point me in the right direction it would be appreciated. -Thanks


Solution

  • To do what you want, you should use the Log (or GetLog) method.

    Client.Log(new Uri(myRepoUrl),
        new SvnLogArgs
        {
            Start = startRevision,
            End = endRevision,
            Limit = numberOfItemsToFetch,
            RetrieveMergedRevisions = true
        },
        (s, e) =>
        {
            // e.MergeLogNestingLevel indicates if this is the first, second or nth level merge
        });
    

    As with every SharpSvn call that takes a delegate, if you want to use the eventargs outside of the delegate, be sure to call e.Detach() inside the delegate/lambda