Exemple #1
0
        private void Clone(IHostedRepository repo)
        {
            string targetDir = GetTargetDir();

            if (targetDir == null)
            {
                return;
            }

            string repoSrc = repo.CloneReadWriteUrl;

            string cmd         = GitCommandHelpers.CloneCmd(repoSrc, targetDir, false, string.Empty, null);
            var    formProcess = new FormProcess(Settings.GitCommand, cmd);

            formProcess.ShowDialog();

            if (formProcess.ErrorOccurred())
            {
                return;
            }

            Repositories.RepositoryHistory.AddMostRecentRepository(targetDir);
            Settings.WorkingDir = targetDir;

            if (_addRemoteAsTB.Text.Trim().Length > 0)
            {
                var error = GitCommandHelpers.AddRemote(_addRemoteAsTB.Text.Trim(), repo.ParentReadOnlyUrl);
                if (!string.IsNullOrEmpty(error))
                {
                    MessageBox.Show(this, error, _strCouldNotAddRemote.Text);
                }
            }

            Close();
        }
Exemple #2
0
        private void NewClick(object sender, EventArgs e)
        {
            var output = GitCommandHelpers.AddRemote("<new>", "");

            if (!string.IsNullOrEmpty(output))
            {
                MessageBox.Show(output, "Delete");
            }
            Initialize();
        }
Exemple #3
0
        private void SaveClick(object sender, EventArgs e)
        {
            var output = "";

            if (string.IsNullOrEmpty(_remote))
            {
                if (string.IsNullOrEmpty(RemoteName.Text) && string.IsNullOrEmpty(Url.Text))
                {
                    return;
                }

                output = GitCommandHelpers.AddRemote(RemoteName.Text, Url.Text);

                if (MessageBox.Show(
                        "You have added a new remote repository." + Environment.NewLine +
                        "Do you want to automatically configure the default push and pull behavior for this remote?",
                        "New remote", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    var remoteUrl = Url.Text;

                    if (!string.IsNullOrEmpty(remoteUrl))
                    {
                        new FormProcess("remote update").ShowDialog();
                        ConfigureRemotes();
                    }
                    else
                    {
                        MessageBox.Show("You need to configure a valid url for this remote", "Url needed");
                    }
                }
            }
            else
            {
                if (RemoteName.Text != _remote)
                {
                    output = GitCommandHelpers.RenameRemote(_remote, RemoteName.Text);
                }

                GitCommandHelpers.SetSetting(string.Format("remote.{0}.url", RemoteName.Text), Url.Text);
                GitCommandHelpers.SetSetting(string.Format("remote.{0}.puttykeyfile", RemoteName.Text), PuttySshKey.Text);
            }

            if (!string.IsNullOrEmpty(output))
            {
                MessageBox.Show(output, "Delete");
            }

            Initialize();
        }