使用方法SVNClient.Diff Diff(SvnTarget target,SvnRevisionRange range,Stream results)

时间:2011-01-13 03:40:53

标签: sharpsvn

鉴于两个不同的修订需要得到它们之间的差异,我打算使用方法duvuelve Diff但是我的任何结果,它可能是?谢谢。 我的代码如下

using (SvnClient client = new SvnClient())
using (MemoryStream result = new MemoryStream())
{
    client.Authentication.DefaultCredentials = new NetworkCredential("asdf", "asdf/*");
    try
    {
        //SvnUriTarget is a wrapper class for SVN repository URIs
        SvnUriTarget target = new SvnUriTarget(textBox1.Text);
        if (client.Diff(target, rango, result))
            MessageBox.Show("Successfully para" + rango.ToString() + ".");


        StreamReader strReader = new StreamReader(result);

        string str = strReader.ReadToEnd();
    }
}

1 个答案:

答案 0 :(得分:5)

从Diff()函数返回的流位于流的末尾,因此在创建流阅读器之前,需要在流的开头重新定位它:

result.Position = 0;
StreamReader strReader = new StreamReader(result);