So I'm using SharpSVN(SharpSvn.1.7-x86 1.7008.2243) and I keep running into a problem. Every time I try to use the SvnWorkingCopyClient
on a repo that's at the root of a drive( for example say I have the D:\
drive, and it itself is a repo) it throws a svn_dirent_is_absolute
error at me.
In fact the only command I could find that didn't care was SvnClient.GetUriFromWorkingCopy(string)
Any Ideas on how I could resolve this(aside from moving my working copy, or linking on the filesystem)? I'm hoping to find a way in code, or an alternative to work around this limitation(as it appears that SVN 1.7 doesn't have this limitation anymore).
Here's some code?
private void fakeFunction(){
var RootPath="d:\";
using (var client = new SharpSvn.SvnClient())
using(var workingClient = new SvnWorkingCopyClient())
{
SvnWorkingCopyVersion workingVersion = null;
// Exception happens here
if (workingClient.GetVersion(this.RootPath, out workingVersion))
{
CurrentRevision = workingVersion.End;
// This will resolve just fine
var targetUri = client.GetUriFromWorkingCopy(RootPath);
var target = SvnTarget.FromUri(targetUri);
SvnInfoEventArgs info = null;
if (client.GetInfo(target, out info))
{
if (workingVersion.End != info.Revision)
{
System.Collections.ObjectModel.Collection<SvnLogEventArgs> logEventArgs = null;
if (client.GetLog(targetUri, out logEventArgs))
{
var oldBack = Console.BackgroundColor;
var oldFor = Console.ForegroundColor;
Console.BackgroundColor = ConsoleColor.DarkMagenta;
Console.ForegroundColor = ConsoleColor.White;
foreach (var l in logEventArgs)
{
Console.WriteLine("[{0}-{1}]-{2}", l.Revision, l.Author, l.LogMessage);
}
Console.BackgroundColor = oldBack;
Console.ForegroundColor = oldFor;
}
System.Console.WriteLine("Repo not up to date.");
}
}
}
}
}
I also stumbled across this http://subversion.tigris.org/issues/show_bug.cgi?id=3535 and http://subversion.tigris.org/ds/viewMessage.do?dsForumId=463&viewType=browseAll&dsMessageId=2456472
So, since that happened way back when, shouldn't this not be an issue anymore?
SharSVN has issue with root paths as we can read in mail-archives. However we can made small hack for your occasion:
Then we need a hack method to get verison
public static bool GetVersionHack(string appPath,string targetPath,out long version)
{
// <param name="appPath">Path to svnversion.exe</param>
// <param name="path">Target path</param>
// <param name="version">Result version</param>
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = appPath;
p.StartInfo.Arguments = targetPath + " -n";
p.Start();
//read svnversion.exe result
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
output = output.Replace("M", "");
output = output.Replace("S", "");
output = output.Replace("P", "");
//valid results
//4123:4168 mixed revision working copy
//4168M modified working copy
//4123S switched working copy
//4123P partial working copy, from a sparse checkout
//4123:4168MS mixed revision, modified, switched working copy
return long.TryParse(output, out version);
}
And modify your fake method full source code
Sure its a dirty work around but it can be helpful. Please be careful with svnversion.exe results GetVersionHack not ideal.