Example #1
0
        private void okButton_Click(object sender, EventArgs e)
        {
            try
            {
                var dirTo = Path.Combine(_NO_TRANSLATE_destinationComboBox.Text, _NO_TRANSLATE_subdirectoryTextBox.Text);

                //Repositories.RepositoryHistory.AddMostRecentRepository(_NO_TRANSLATE_From.Text);
                //Repositories.RepositoryHistory.AddMostRecentRepository(dirTo);

                if (!Directory.Exists(dirTo))
                {
                    Directory.CreateDirectory(dirTo);
                }

                var  authorsfile      = this._NO_TRANSLATE_authorsFileTextBox.Text.Trim();
                bool resetauthorsfile = false;
                if (!String.IsNullOrEmpty(authorsfile) && !File.Exists(authorsfile) && !(resetauthorsfile = AskContinutWithoutAuthorsFile(authorsfile)))
                {
                    return;
                }
                if (resetauthorsfile)
                {
                    authorsfile = null;
                }
                int from;
                if (!int.TryParse(tbFrom.Text, out from))
                {
                    from = 0;
                }

                var errorOccurred = !FormProcess.ShowDialog(this, AppSettings.GitCommand,
                                                            GitSvnCommandHelpers.CloneCmd(_NO_TRANSLATE_SvnFrom.Text, dirTo,
                                                                                          tbUsername.Text, authorsfile, from,
                                                                                          cbTrunk.Checked ? _NO_TRANSLATE_tbTrunk.Text : null,
                                                                                          cbTags.Checked ? _NO_TRANSLATE_tbTags.Text : null,
                                                                                          cbBranches.Checked ? _NO_TRANSLATE_tbBranches.Text : null));

                if (errorOccurred || Module.InTheMiddleOfPatch())
                {
                    return;
                }
                if (ShowInTaskbar == false && AskIfNewRepositoryShouldBeOpened(dirTo))
                {
                    if (GitModuleChanged != null)
                    {
                        GitModuleChanged(this, new GitModuleEventArgs(new GitModule(dirTo)));
                    }
                }
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Exception: " + ex.Message, "Clone failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private void okButton_Click(object sender, EventArgs e)
        {
            try
            {
                var dirTo = this._NO_TRANSLATE_destinationComboBox.Text;
                if (!dirTo.EndsWith(Settings.PathSeparator.ToString()) && !dirTo.EndsWith(Settings.PathSeparatorWrong.ToString()))
                {
                    dirTo += Settings.PathSeparator.ToString();
                }

                dirTo += this._NO_TRANSLATE_subdirectoryTextBox.Text;

                //Repositories.RepositoryHistory.AddMostRecentRepository(_NO_TRANSLATE_From.Text);
                //Repositories.RepositoryHistory.AddMostRecentRepository(dirTo);

                if (!Directory.Exists(dirTo))
                {
                    Directory.CreateDirectory(dirTo);
                }

                var  authorsfile      = this._NO_TRANSLATE_authorsFileTextBox.Text;
                bool resetauthorsfile = false;
                if (authorsfile != null && authorsfile.Trim().Length != 0 && !File.Exists(authorsfile.Trim()) && !(resetauthorsfile = AskContinutWithoutAuthorsFile(authorsfile)))
                {
                    return;
                }
                if (resetauthorsfile)
                {
                    authorsfile = null;
                }
                var errorOccurred = !FormProcess.ShowDialog(this, Settings.GitCommand,
                                                            GitSvnCommandHelpers.CloneCmd(_NO_TRANSLATE_svnRepositoryComboBox.Text, dirTo, authorsfile));

                if (errorOccurred || Module.InTheMiddleOfPatch())
                {
                    return;
                }
                if (ShowInTaskbar == false && AskIfNewRepositoryShouldBeOpened(dirTo))
                {
                    if (GitModuleChanged != null)
                    {
                        GitModuleChanged(new GitModule(dirTo));
                    }
                }
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Exception: " + ex.Message, "Clone failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }