1

我想将我计算机中工作副本的更改提交到存储库。存储库位于 URL 中,我现在正在这样做:

using (SvnClient client = new SvnClient())
{
    SvnCommitArgs ca = new SvnCommitArgs();

    ca.ChangeLists.Add(workingcopydir + filename);

    ca.LogMessage = "Change";

    client.Add(workingcopydir + filename);



    try
    {
        client.Commit(workingcopydir, ca);

        //, ca, out resultado
    }
    catch (Exception exc)
    {
        MessageBox.Show(this, exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
}

但它不起作用,当它完成时,文件被添加但未提交。为什么?谢谢!!!:)

4

2 回答 2

4

FWIW,我这样做:

    public bool Add (string path)
    {
        using(SvnClient client = NewSvnClient()){
            SvnAddArgs args = new SvnAddArgs();
            args.Depth = SvnDepth.Empty;
            args.AddParents = true;
            return client.Add(path, args);
        }
    }

    public bool Commit (string path, string message)
    {
        using(SvnClient client = NewSvnClient()){
            SvnCommitArgs args  = new SvnCommitArgs();

            args.LogMessage     = message;
            args.ThrowOnError   = true;
            args.ThrowOnCancel  = true;

            try { 
                return client.Commit(path, args);
            } catch(Exception e){
                if( e.InnerException != null ){
                    throw new Exception(e.InnerException.Message, e);
                }

                throw e;
            }
        }
    }

然后我称之为:

  repo.Add("some folder");

  ...

  repo.Commit("base working copy");
于 2010-03-02T10:13:37.260 回答
1

ChangeList 参数用作过滤器。只有标记为在特定更改列表中的文件才会被操作。

对于提交,您可以只提供多个目标。

于 2010-03-02T12:25:14.873 回答