0

I m trying to commit changes to the project to my svn server but it doesnt seem to work.

The Test: I run the code below with the folder where nothing has been changed and nothing happens as expected, Then I create a new folder and then run the code again, this time nothing seems to happen, the code runs and returns without the error showing it worked.

public bool svnCommitProject(String project, String message)
{
    using (SvnClient client = new SvnClient())
    {
        try
        {
            SvnCommitArgs args = new SvnCommitArgs();
            args.LogMessage = message;
            client.Authentication.ForceCredentials(Properties.Settings.Default.Username, Properties.Settings.Default.Password);
            return client.Commit(Properties.Settings.Default.LocalFolderPath + Properties.Settings.Default.Username + @"\" + project, args);
        }
        catch
        {
            MessageBox.Show("ERROR");
            return false;
        }
    }
}

Suspected Problem: From looking at this and google i suspect that the problem exists because the file hasnt been "added" to svn control, but im not sure.

Is this the case? and if so how would I go about adding the files which need to be added? I also assume that something similar would be needed for files which are deleted/modified, is this correct and how would I add this in too?

NoLiver92
  • 882
  • 3
  • 15
  • 39
  • "nothing happens as expected" - OK, then what **does** happen? – alroc Jan 26 '15 at 02:13
  • @alroc if you read my post, I have said in the test section, the code runs and the error message doesnt show. Meaning the catch section wasnt utilized and the code in the try did. BUT nothing is comitted, there are new files in the svn folder but there is no log and history of the commit. if you delete the whole folder and check it out again, the new files are not there. There are no errors and nothing happens, no commit - nothing. – NoLiver92 Jan 26 '15 at 09:40

1 Answers1

0

See Find files not added to subversion

Yes, files just dropped into the local working directory doesn't tell the SVN to commit to.

Collection<SvnStatusEventArgs> filesStatuses = new Collection<SvnStatusEventArgs>();
if (!client.GetStatus(localDir, new SvnStatusArgs
{
    Depth = SvnDepth.Infinity,
    RetrieveRemoteStatus = true,
    RetrieveAllEntries = true
}, out workDirFilesStatus))
{
    throw new SvnOperationCanceledException("SvnClient.GetStatus doesn't return anything.");
}

filesStatuses.Where(i => i.LocalContentStatus == SvnStatus.NotVersioned).ToList().ForEach(i => svnC.Add(i.Path));
filesStatuses.Where(i => i.LocalContentStatus == SvnStatus.Missing).ToList().ForEach(i => svnC.Delete(i.Path));
Community
  • 1
  • 1
soumasandesu
  • 301
  • 2
  • 10