Esempio n. 1
0
 internal void Commit(string text, SvnCommitArgs args, SvnCommitResult result)
 {
     using (SharpSvn.SvnClient client = new SharpSvn.SvnClient())
     {
         SvnCommitArgs ca = new SvnCommitArgs();
         client.Commit(args.LogMessage, ca);
     }
 }
Esempio n. 2
0
        private void btnCommit_Click(object sender, EventArgs e)
        {
            if (tbFileName.Text.Length == 0)
            {
                MessageBox.Show("dosya seç");
                return;
            }
            SvnCommitArgs args = new SvnCommitArgs();

            args.LogMessage = tbMessage.Text;
            SvnCommitResult result;

            using (SharpSvn.SvnClient client = new SharpSvn.SvnClient())
            {
                try
                {
                    SvnUI.Bind(client, this);

                    client.Commit(tbFileName.Text, args, out result);
                    if (result != null)
                    {
                        MessageBox.Show("başarıyla revize edildi" + result.Revision + ".");
                    }
                    else
                    {
                        MessageBox.Show("teslim edildiğinden beri hiçbir değişiklilik yapılmamıştır");
                    }
                }

                catch (SvnException se)
                {
                    MessageBox.Show(se.Message + "Error: " + se.SvnErrorCode + Environment.NewLine,
                                    "svn commit error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 3
0
 public bool Commit()
 {
     if (!m_loggedIn)
         return false;
     using (m_client = new SvnClient())
     {
         m_client.Authentication.Clear();
         m_client.Authentication.DefaultCredentials = new System.Net.NetworkCredential(m_strUser, m_strPassword);
         m_client.Authentication.SslServerTrustHandlers += delegate(object sender, SharpSvn.Security.SvnSslServerTrustEventArgs e)
         {
             e.AcceptedFailures = e.Failures;
             e.Save = true; // save acceptance to authentication store
         };
         System.Collections.ObjectModel.Collection<SvnLogEventArgs> logEntries;
         SvnLogArgs logArgs = new SvnLogArgs();
         logArgs.Limit = 1;
         try
         {
             m_client.GetLog(m_uriRepository.Uri, logArgs, out logEntries);
             m_loggedIn = true;
         }
         catch (SvnException ex)
         {
             System.Windows.Forms.MessageBox.Show(ex.Message, "SVN Connect Error", System.Windows.Forms.MessageBoxButtons.OK);
             m_loggedIn = false;
             return false;
         }
         try
         {
             SvnCommitArgs args = new SvnCommitArgs();
             args.LogMessage = "Update release data " + DateTime.Now.ToString();
             args.Depth = SvnDepth.Infinity;
             return m_client.Commit(m_client.GetWorkingCopyRoot(m_strCheckoutPath), args);
         }
         catch (SvnException ex)
         {
             String msg = ex.Message + Environment.NewLine + Environment.NewLine +
                 ex.StackTrace.ToString();
             System.Windows.Forms.MessageBox.Show(ex.Message, "SVN Commit Error", System.Windows.Forms.MessageBoxButtons.OK);
             return false;
         }
     }
 }
Esempio n. 4
0
        public static void CompleteSync(Parameters parameters)
        {
            using (var client = new SharpSvn.SvnClient())
            {
                SetUpClient(parameters, client);

                if (parameters.UpdateBeforeCompleteSync)
                {
                    DebugMessage(parameters, "Updating");
                    client.Update(parameters.Path);
                    DebugMessage(parameters, "Done");
                }

                Collection <SvnStatusEventArgs> changedFiles;
                DebugMessage(parameters, "Getting status");
                client.GetStatus(parameters.Path, out changedFiles);
                DebugMessage(parameters, "Done");
                if (changedFiles.Count == 0)
                {
                    Console.WriteLine("No changes to commit.");
                    return;
                }

                //delete files from subversion that are not in filesystem
                //add files to subversion that are new in filesystem
                //modified files are automatically included as part of the commit

                //TODO: check remoteStatus
                DebugMessage(parameters, "Recording changes");
                foreach (var changedFile in changedFiles)
                {
                    if (changedFile.LocalContentStatus == SvnStatus.Missing)
                    {
                        // SVN thinks file is missing but it still exists hence
                        // a change in the case of the filename.
                        if (File.Exists(changedFile.Path))
                        {
                            var changedArgs = new SvnDeleteArgs {
                                KeepLocal = true
                            };
                            client.Delete(changedFile.Path, changedArgs);
                        }
                        else
                        {
                            client.Delete(changedFile.Path);
                        }
                    }
                    if (changedFile.LocalContentStatus == SvnStatus.NotVersioned)
                    {
                        client.Add(changedFile.Path);
                    }
                }
                DebugMessage(parameters, "Done");

                var ca = new SvnCommitArgs {
                    LogMessage = parameters.Message
                };
                SvnCommitResult result;
                DebugMessage(parameters, "Committing");
                if (client.Commit(parameters.Path, ca, out result))
                {
                    DebugMessage(parameters, "Done");
                    if (result == null)
                    {
                        Console.WriteLine("No result returned from commit.");
                        return;
                    }
                    if (!string.IsNullOrEmpty(result.PostCommitError))
                    {
                        Console.WriteLine("Post-commit hook error: " + result.PostCommitError);
                        return;
                    }
                    Console.WriteLine("Committed r" + result.Revision);
                }
                else
                {
                    if (result != null && !string.IsNullOrEmpty(result.PostCommitError))
                    {
                        Console.WriteLine("Post-commit hook error after failed commit: " + result.PostCommitError);
                        return;
                    }
                    Console.WriteLine("Commit failed.");
                }
            }
        }
Esempio n. 5
0
        public static void CompleteSync(Parameters parameters)
        {
            using (var client = new SharpSvn.SvnClient())
            {
                SetUpClient(parameters, client);

                if (parameters.UpdateBeforeCompleteSync)
                {
                    DebugMessage(parameters, "Updating");
                    client.Update(parameters.Path);
                    DebugMessage(parameters, "Done");
                }

                Collection<SvnStatusEventArgs> changedFiles;
                DebugMessage(parameters, "Getting status");
                client.GetStatus(parameters.Path, out changedFiles);
                DebugMessage(parameters, "Done");
                if(changedFiles.Count == 0)
                {
                    Console.WriteLine("No changes to commit.");
                    return;
                }

                //delete files from subversion that are not in filesystem
                //add files to subversion that are new in filesystem
                //modified files are automatically included as part of the commit

                //TODO: check remoteStatus
                DebugMessage(parameters, "Recording changes");
                foreach (var changedFile in changedFiles)
                {
                    if (changedFile.LocalContentStatus == SvnStatus.Missing)
                    {
                        // SVN thinks file is missing but it still exists hence
                        // a change in the case of the filename.
                        if (File.Exists(changedFile.Path))
                        {
                            var changedArgs = new SvnDeleteArgs {KeepLocal = true};
                            client.Delete(changedFile.Path, changedArgs);
                        }
                        else
                            client.Delete(changedFile.Path);
                    }
                    if (changedFile.LocalContentStatus == SvnStatus.NotVersioned)
                    {
                        client.Add(changedFile.Path);
                    }
                }
                DebugMessage(parameters, "Done");

                var ca = new SvnCommitArgs {LogMessage = parameters.Message};
                SvnCommitResult result;
                DebugMessage(parameters, "Committing");
                if (client.Commit(parameters.Path, ca, out result))
                {
                    DebugMessage(parameters, "Done");
                    if(result == null)
                    {
                        Console.WriteLine("No result returned from commit.");
                        return;
                    }
                    if (!string.IsNullOrEmpty(result.PostCommitError))
                    {
                        Console.WriteLine("Post-commit hook error: " + result.PostCommitError);
                        return;
                    }
                    Console.WriteLine("Committed r" + result.Revision);
                }
                else
                {
                    if (result != null && !string.IsNullOrEmpty(result.PostCommitError))
                    {
                        Console.WriteLine("Post-commit hook error after failed commit: " + result.PostCommitError);
                        return;
                    }
                    Console.WriteLine("Commit failed.");
                }
            }
        }