Pergunta

I am using SharpSvn in my C# project. I am having a folder with some text files in it and another folders with subfolders in it. I am adding the folder under version control and commit it. So far, so good. This is my code:

using (SvnClient client = new SvnClient())
                    {

                        SvnCommitArgs ca = new SvnCommitArgs();

                        SvnStatusArgs sa = new SvnStatusArgs();
                        sa.Depth = SvnDepth.Empty; 

                        Collection<SvnStatusEventArgs> statuses;

                        client.GetStatus(pathsConfigurator.FranchisePath, sa, out statuses);
                        if (statuses.Count == 1)
                        {
                            if (!statuses[0].Versioned)
                            {
                                client.Add(pathsConfigurator.FranchisePath);
                                ca.LogMessage = "Added";
                                client.Commit(pathsConfigurator.FranchisePath, ca);
                            }
                            else if (statuses[0].Modified)
                            {
                                ca.LogMessage = "Modified";
                                client.Commit(pathsConfigurator.FranchisePath, ca);
                            }

                        }
                    }

I make some changes to one of the text files and then run the code againg. The modification is not committed. This condition is false:

if (statuses.Count == 1)

and all the logic in the if block does not execute.

I have not written this logic and cannot quite get this lines of code:

client.GetStatus(pathsConfigurator.FranchisePath, sa, out statuses);
                        if (statuses.Count == 1) {}

I went on the oficial site of the API but couldn`t find documentation about this.

  1. Can someone that is more familiar with this API tell what these two lines do ?

  2. What changes need to be done to this code so if some of the contents of the pathsConfigurator.FranchisePath folder are changed, the whole folder with the changes to be commited. Any suggestions with working example will be greatly appreciated.

Foi útil?

Solução

Committing one directory with everything inside is pretty easy: Just call commit on that directory.

The default Depth of commit is SvnDepth.Infinity so that would work directly. You can set additional options by providing a SvnCommitArgs object to SvnClient.Commit()

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top