/// <summary>
        /// Add new remote repository
        /// </summary>
        private void BtAddClick(object sender, EventArgs e)
        {
            ClassRemotes.Remote remote = new ClassRemotes.Remote();
            FormRemoteAddEdit remoteAddEdit = new FormRemoteAddEdit();
            remoteAddEdit.Prepare(FormRemoteAddEdit.Function.Add, remote);

            if (remoteAddEdit.ShowDialog() == DialogResult.OK)
            {
                remote = remoteAddEdit.Get();
                _repo.Run("remote add " + remote.Name + " " + remote.UrlFetch);
                _repo.Remotes.SetPassword(remote.Name, remote.Password);
                _repo.Remotes.SetPushCmd(remote.Name, remote.PushCmd);

                SetRepo(_repo);
            }
        }
        /// <summary>
        /// Edit selected remote repository
        /// </summary>
        private void BtEditClick(object sender, EventArgs e)
        {
            ClassRemotes.Remote remote;
            FormRemoteAddEdit   remoteAddEdit = new FormRemoteAddEdit();

            remoteAddEdit.Prepare(FormRemoteAddEdit.Function.Edit, _current);

            if (remoteAddEdit.ShowDialog() == DialogResult.OK)
            {
                // Get new values and start comparing what changed
                remote = remoteAddEdit.Get();

                if (remote.UrlFetch != _current.UrlFetch)
                {
                    // Change the fetch URL
                    _repo.Run("remote set-url " + remote.Name + " " + remote.UrlFetch);

                    // However, this will also change the push URL, so reset it
                    if (_current.UrlPush != "")
                    {
                        _repo.Run("remote set-url --push " + remote.Name + " " + _current.UrlPush);
                    }
                }

                if (remote.UrlPush != _current.UrlPush)
                {
                    // Change the push URL
                    _repo.Run("remote set-url --push " + remote.Name + " " + remote.UrlPush);
                }

                if (remote.Password != _current.Password)
                {
                    // Change the password
                    _repo.Remotes.SetPassword(remote.Name, remote.Password);
                }

                if (remote.PushCmd != _current.PushCmd)
                {
                    // Change the push command
                    _repo.Remotes.SetPushCmd(remote.Name, remote.PushCmd);
                }

                SetRepo(_repo);
            }
        }
        /// <summary>
        /// Rename selected remote repository
        /// </summary>
        private void BtRenameClick(object sender, EventArgs e)
        {
            ClassRemotes.Remote remote;
            FormRemoteAddEdit   remoteAddEdit = new FormRemoteAddEdit();

            remoteAddEdit.Prepare(FormRemoteAddEdit.Function.Rename, _current);

            if (remoteAddEdit.ShowDialog() == DialogResult.OK)
            {
                // Get new name and change it
                remote = remoteAddEdit.Get();
                if (remote.Name != _current.Name)
                {
                    _repo.Run("remote rename " + _current.Name + " " + remote.Name);
                    SetRepo(_repo);
                }
            }
        }
示例#4
0
        /// <summary>
        /// Add new remote repository
        /// </summary>
        private void BtAddClick(object sender, EventArgs e)
        {
            ClassRemotes.Remote remote = new ClassRemotes.Remote();
            FormRemoteAddEdit remoteAddEdit = new FormRemoteAddEdit();
            remoteAddEdit.Prepare(FormRemoteAddEdit.Function.Add, remote);

            if (remoteAddEdit.ShowDialog() == DialogResult.OK)
            {
                remote = remoteAddEdit.Get();
                ExecResult result = _repo.Run("remote add " + remote.Name + " " + remote.UrlFetch);
                if (result.Success())
                {
                    _repo.Remotes.SetPassword(remote.Name, remote.Password);
                    _repo.Remotes.SetPushCmd(remote.Name, remote.PushCmd);
                    SetRepo(_repo);
                }
                else
                {
                    MessageBox.Show("Git is unable to add this remote repository.", "Add remote repository", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    App.PrintStatusMessage(result.stderr, MessageType.Error);
                }
            }
        }
        /// <summary>
        /// Add new remote repository
        /// </summary>
        private void BtAddClick(object sender, EventArgs e)
        {
            ClassRemotes.Remote remote        = new ClassRemotes.Remote();
            FormRemoteAddEdit   remoteAddEdit = new FormRemoteAddEdit();

            remoteAddEdit.Prepare(FormRemoteAddEdit.Function.Add, remote);

            if (remoteAddEdit.ShowDialog() == DialogResult.OK)
            {
                remote = remoteAddEdit.Get();
                ExecResult result = _repo.Run("remote add " + remote.Name + " " + remote.UrlFetch);
                if (result.Success())
                {
                    _repo.Remotes.SetPassword(remote.Name, remote.Password);
                    _repo.Remotes.SetPushCmd(remote.Name, remote.PushCmd);
                    SetRepo(_repo);
                }
                else
                {
                    MessageBox.Show("Git is unable to add this remote repository.", "Add remote repository", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    App.PrintStatusMessage(result.stderr, MessageType.Error);
                }
            }
        }
示例#6
0
        /// <summary>
        /// Edit selected remote repository
        /// </summary>
        private void BtEditClick(object sender, EventArgs e)
        {
            ClassRemotes.Remote remote;
            FormRemoteAddEdit remoteAddEdit = new FormRemoteAddEdit();
            remoteAddEdit.Prepare(FormRemoteAddEdit.Function.Edit, _current);

            if (remoteAddEdit.ShowDialog() == DialogResult.OK)
            {
                // Get new values and start comparing what changed
                remote = remoteAddEdit.Get();

                if (remote.UrlFetch != _current.UrlFetch)
                {
                    // Change the fetch URL
                    _repo.Run("remote set-url " + remote.Name + " " + remote.UrlFetch);

                    // However, this will also change the push URL, so reset it
                    if (_current.UrlPush != "")
                        _repo.Run("remote set-url --push " + remote.Name + " " + _current.UrlPush);
                }

                if (remote.UrlPush != _current.UrlPush)
                {
                    // Change the push URL
                    _repo.Run("remote set-url --push " + remote.Name + " " + remote.UrlPush);
                }

                if (remote.Password != _current.Password)
                {
                    // Change the password
                    _repo.Remotes.SetPassword(remote.Name, remote.Password);
                }

                if (remote.PushCmd != _current.PushCmd)
                {
                    // Change the push command
                    _repo.Remotes.SetPushCmd(remote.Name, remote.PushCmd);
                }

                SetRepo(_repo);
            }
        }
示例#7
0
        /// <summary>
        /// Rename selected remote repository
        /// </summary>
        private void BtRenameClick(object sender, EventArgs e)
        {
            ClassRemotes.Remote remote;
            FormRemoteAddEdit remoteAddEdit = new FormRemoteAddEdit();
            remoteAddEdit.Prepare(FormRemoteAddEdit.Function.Rename, _current);

            if (remoteAddEdit.ShowDialog() == DialogResult.OK)
            {
                // Get new name and change it
                remote = remoteAddEdit.Get();
                if (remote.Name != _current.Name)
                {
                    _repo.Run("remote rename " + _current.Name + " " + remote.Name);
                    SetRepo(_repo);
                }
            }
        }