Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is SharpSVN SvnClient.Export(...) not always finding files that should be there?

I am using the Export() member function to obtain files at specific revisions which is working but for some reason in other cases it is not. For all the modified paths it seems to be working however with the deleted and sometimes added files in that revision I get the exception stating that there is no file at the url used. When I use the TurtoiseSVNs "Copy Revision to..." on these paths it works fine and I'm just wondering if I am missing something with SharpSVN, I would like the full versions at the revision of all the modified files. Heres the general idea of my code:

if (logentry.ChangedPaths != null)
{
     foreach (SvnChangeItem svnChangeItem in logentry.ChangedPaths)
     {
         SvnExportArgs ex = new SvnExportArgs();
         ex.Revision = revisionNum;
         client.Export(SvnTarget.FromUri(new Uri(pathInsideRepo)), exportFile, ex);
     }
}

Any help or suggestions would be appreciated, thanks.

like image 718
Sam F Avatar asked Jun 23 '10 18:06

Sam F


2 Answers

I found that using a SvnUriTarget instead of just the uri with the SvnExportArgs allowed me to obtain the correct information. Not too sure on why they are different but it works.

so instead of the Export above I used:

client.Export(new SvnUriTarget(new Uri(pathInsideRepo), revisionNumber), exportFile, ex);

The answer I found was at link text

like image 57
Sam F Avatar answered Sep 22 '22 13:09

Sam F


The command line client has the same behavior. What's going on is that the URLs pointing to a file can come and go. This means that the url pointing to a file that is now deleted is invalid, unless you specify you want to use an older url. This is called a peg revision.

Read up on peg revisions in the svnbook.

like image 36
Sander Rijken Avatar answered Sep 22 '22 13:09

Sander Rijken