• 使用SharpSvn方便调用svn


    需要调用svn去做一些操作时,有两种方式:调用svn.exe命令行和调用svn api接口。我不太喜欢调用命令行的方式,是因为它需要依赖一个外部的exe程序,同时,为了得到命令执行结果,还需要去捕捉命令行的输出控制台,然后去解析,使得不太可靠。因此,我选择了调用svn接口的方式,因为我使用的是c#,有一个现成的第三方包装的库SharpSvn可以调用。

    SharpSvn主页:

    http://sharpsvn.open.collab.net/

    使用起来很简单,下面是一个例子:

    static void Main(string[] args)
    {
        using (SvnClient client = new SvnClient())
        {
            SvnInfoEventArgs serverInfo;
            SvnInfoEventArgs clientInfo;
            SvnUriTarget repos = new SvnUriTarget("http://svn.test.com/demo");
            SvnPathTarget local = new SvnPathTarget(@"d:\Work\Code\demo");

            client.GetInfo(repos, out serverInfo);
            client.GetInfo(local, out clientInfo);

            string path = @"d:\Work\Code\Demo";
            client.CleanUp(path);
            client.Revert(path);
            client.Update(path);

            Console.WriteLine(string.Format("serverInfo revision of {0} is {1}", repos, serverInfo.Revision));
            Console.WriteLine(string.Format("clientInfo revision of {0} is {1}", local, clientInfo.Revision));
        }

  • 相关阅读:
    一些个人看到觉得还不错的资料,现在先把记得的保存下来,以后碰到会继续更新
    鼠标 mouseover和mouseout事件
    phpqrcode 生成二维码
    django url路径与模板中样式相对路径的问题
    js parseInt和map函数
    WebService 布置简单的计算器
    java ++的使用
    java 运算符
    Java的概念
    public 有跟没有的区别
  • 原文地址:https://www.cnblogs.com/goody9807/p/2749633.html
Copyright © 2020-2023  润新知