tags:

views:

96

answers:

2

Hello! I want to commit the changes of a working copy in my computer to the repository. The repository is in an URL and i´m doing this now:

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);
    }
}

But it doesn´t work, when it finish the file is added but not commited. Why? Thanks!!! :)

+1  A: 

FWIW, I do it like so:

    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;
            }
        }
    }

Then I call it like:

  repo.Add("some folder");

  ...

  repo.Commit("base working copy");
Noon Silk
Thank you very very much, it works!!!!
Pedro
@Pedro: You're welcome :)
Noon Silk
+1  A: 

The ChangeList argument works as a filter. Only files that are marked to be in the specific changelists will be operated upon.

For commit you can just provide multiple targets.

Bert Huijben