示例#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);
            }
        }
示例#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);
            }
        }
示例#3
0
        public bool StartSvnFetchDialog(IWin32Window owner)
        {
            if (!RequiredValidGitSvnWorikingDir(owner))
            {
                return(false);
            }

            if (!InvokeEvent(owner, PreSvnFetch))
            {
                return(true);
            }

            FormProcess.ShowDialog(owner, Settings.GitCommand, GitSvnCommandHelpers.FetchCmd());

            InvokeEvent(owner, PostSvnFetch);

            return(true);
        }
示例#4
0
        public bool StartSvnRebaseDialog(IWin32Window owner)
        {
            if (!RequiredValidGitSvnWorikingDir())
            {
                return(false);
            }

            if (!InvokeEvent(PreSvnRebase))
            {
                return(true);
            }

            var fromProcess = new FormProcess(Settings.GitCommand, GitSvnCommandHelpers.RebaseCmd());

            fromProcess.ShowDialog(owner);

            InvokeEvent(PostSvnRebase);

            return(true);
        }
示例#5
0
        private bool RequiredValidGitSvnWorikingDir(object owner)
        {
            if (!RequiresValidWorkingDir(owner))
            {
                return(false);
            }

            if (!GitSvnCommandHelpers.ValidSvnWorkingDir())
            {
                MessageBoxes.NotValidGitSVNDirectory(owner as IWin32Window);
                return(false);
            }

            if (!GitSvnCommandHelpers.CheckRefsRemoteSvn())
            {
                MessageBoxes.UnableGetSVNInformation(owner as IWin32Window);
                return(false);
            }

            return(true);
        }
示例#6
0
        private bool RequiredValidGitSvnWorikingDir()
        {
            if (!RequiresValidWorkingDir())
            {
                return(false);
            }

            if (!GitSvnCommandHelpers.ValidSvnWorkingDir())
            {
                MessageBox.Show("The current directory is not a valid git-svn repository.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (!GitSvnCommandHelpers.CheckRefsRemoteSvn())
            {
                MessageBox.Show("Unable to determine upstream SVN information.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }