Beispiel #1
0
 private void ViewSelectedFileDiff()
 {
     using (WaitCursorScope.Enter())
     {
         diffViewer.ViewChangesAsync(DiffFiles.SelectedItem);
     }
 }
Beispiel #2
0
 private void RevisionGridSelectionChanged(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         DiffFiles.SetDiffs(RevisionGrid.GetSelectedRevisions());
     }
 }
Beispiel #3
0
 private void RefreshAll()
 {
     using (WaitCursorScope.Enter())
     {
         Initialize();
     }
 }
Beispiel #4
0
        private void SaveAs(string side)
        {
            using (WaitCursorScope.Enter())
            {
                var    conflictData = GetConflict();
                string fileName     = conflictData.Filename;
                fileName = PathUtil.GetFileName(fileName);

                using (var fileDialog = new SaveFileDialog
                {
                    FileName = fileName,
                    InitialDirectory = _fullPathResolver.Resolve(PathUtil.GetDirectoryName(conflictData.Filename)),
                    AddExtension = true
                })
                {
                    var ext = PathUtil.GetFileExtension(fileDialog.FileName);
                    fileDialog.DefaultExt = ext;
                    fileDialog.Filter     = string.Format(_currentFormatFilter.Text, ext) + "|*." + ext + "|" + _allFilesFilter.Text + "|*.*";

                    if (fileDialog.ShowDialog(this) == DialogResult.OK)
                    {
                        if (!Module.HandleConflictsSaveSide(conflictData.Filename, fileDialog.FileName, side))
                        {
                            MessageBox.Show(this, _failureWhileSaveFile.Text);
                        }
                    }
                }
            }
        }
Beispiel #5
0
 private void FormSettings_Shown(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         LoadSettings();
     }
 }
Beispiel #6
0
 private void OpenMergetool_Click(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         ConflictedFiles_DoubleClick(sender, e);
     }
 }
Beispiel #7
0
 private void buttonApply_Click(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         Save();
     }
 }
Beispiel #8
0
 private void buttonDiscard_Click(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         LoadSettings();
     }
 }
Beispiel #9
0
        private void StashedSelectedIndexChanged(object sender, EventArgs e)
        {
            GitStash      gitStash    = Stashes.SelectedItem as GitStash;
            GitItemStatus stashedItem = Stashed.SelectedItem;

            EnablePartialStash();

            using (WaitCursorScope.Enter())
            {
                if (stashedItem != null &&
                    gitStash == _currentWorkingDirStashItem)
                {
                    // current working directory
                    View.ViewCurrentChanges(stashedItem);
                }
                else if (stashedItem != null)
                {
                    if (stashedItem.IsNew)
                    {
                        if (!stashedItem.IsSubmodule)
                        {
                            View.ViewGitItemAsync(stashedItem.Name, stashedItem.TreeGuid);
                        }
                        else
                        {
                            View.ViewTextAsync(
                                stashedItem.Name,
                                LocalizationHelpers.GetSubmoduleText(Module, stashedItem.Name, stashedItem.TreeGuid));
                        }
                    }
                    else
                    {
                        string   extraDiffArguments = View.GetExtraDiffArguments();
                        Encoding encoding           = View.Encoding;
                        View.ViewPatchAsync(
                            () =>
                        {
                            Patch patch = Module.GetSingleDiff(gitStash.Name + "^", gitStash.Name, stashedItem.Name, stashedItem.OldName, extraDiffArguments, encoding, true, stashedItem.IsTracked);
                            if (patch == null)
                            {
                                return(text: string.Empty, openWithDifftool: null /* not applicable */);
                            }

                            if (stashedItem.IsSubmodule)
                            {
                                return(text: LocalizationHelpers.ProcessSubmodulePatch(Module, stashedItem.Name, patch),
                                       openWithDifftool: null /* not implemented */);
                            }

                            return(text: patch.Text, openWithDifftool: null /* not implemented */);
                        });
                    }
                }
                else
                {
                    View.ViewTextAsync(string.Empty, string.Empty);
                }
            }
        }
Beispiel #10
0
 private void ContextMarkAsSolved_Click(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         StageFile(GetFileName());
         Initialize();
     }
 }
 private void Abort_Click(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         FormProcess.ShowDialog(this, GitCommandHelpers.AbortCmd());
         EnableButtons();
     }
 }
Beispiel #12
0
 private void UpdateSubmoduleClick(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         FormProcess.ShowDialog(this, process: null, arguments: GitCommandHelpers.SubmoduleUpdateCmd(SubModuleLocalPath.Text), Module.WorkingDir, input: null, useDialogSettings: true);
         Initialize();
     }
 }
Beispiel #13
0
 private void Abort_Click(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         FormProcess.ShowDialog(this, process: null, arguments: GitCommandHelpers.AbortCmd(), Module.WorkingDir, input: null, useDialogSettings: true);
         EnableButtons();
     }
 }
 private void Mergetool_Click(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         Directory.SetCurrentDirectory(Module.WorkingDir);
         Module.RunMergeTool();
         Initialize();
     }
 }
Beispiel #15
0
 private void Mergetool_Click(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         Directory.SetCurrentDirectory(Module.WorkingDir);
         Module.RunExternalCmdShowConsole(AppSettings.GitCommand, "mergetool");
         Initialize();
     }
 }
Beispiel #16
0
 private void SaveAndRescan_Click(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         PageHost.SaveAll();
         PageHost.LoadAll();
         CheckSettings();
     }
 }
Beispiel #17
0
 private void Ok_Click(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         if (Save())
         {
             Close();
         }
     }
 }
Beispiel #18
0
 private void ViewSelectedFileDiff()
 {
     using (WaitCursorScope.Enter())
     {
         var revisions   = RevisionGrid.GetSelectedRevisions();
         var selectedRev = revisions.FirstOrDefault();
         var firstId     = revisions.Skip(1).LastOrDefault()?.ObjectId ?? selectedRev?.FirstParentGuid;
         diffViewer.ViewChangesAsync(firstId, selectedRev, DiffFiles.SelectedItem);
     }
 }
Beispiel #19
0
 private void Reset_Click(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         if (ShowAbortMessage())
         {
             Module.ResetHard("");
             Close();
         }
     }
 }
Beispiel #20
0
        private void StashedSelectedIndexChanged(object sender, EventArgs e)
        {
            GitItemStatus stashedItem = Stashed.SelectedItem;

            EnablePartialStash();

            using (WaitCursorScope.Enter())
            {
                // Special revision handling, see LoadGitItemStatuses()
                View.ViewChangesAsync(null, Stashed.SelectedItemParent, stashedItem);
            }
        }
Beispiel #21
0
        private void BranchesDropDown(object sender, EventArgs e)
        {
            if ((PullFromUrl.Checked && string.IsNullOrEmpty(comboBoxPullSource.Text)) &&
                (PullFromRemote.Checked && string.IsNullOrEmpty(_NO_TRANSLATE_Remotes.Text)))
            {
                Branches.DataSource = null;
                return;
            }

            using (WaitCursorScope.Enter())
            {
                LoadPuttyKey();

                if (_heads == null)
                {
                    if (PullFromUrl.Checked)
                    {
                        _heads = Module.GetRefs(false, true).ToList();
                    }
                    else
                    {
                        // The line below is the most reliable way to get a list containing
                        // all remote branches but it is also the slowest.
                        // Heads = GitCommands.GitCommands.GetRemoteHeads(Remotes.Text, false, true);

                        // The code below is a quick way to get a list contains all remote branches.
                        // It only returns the heads that are already known to the repository. This
                        // doesn't return heads that are new on the server. This can be updated using
                        // update branch info in the manage remotes dialog.
                        _heads = new List <IGitRef>();
                        foreach (var head in Module.GetRefs(true, true))
                        {
                            if (!head.IsRemote ||
                                !head.Name.StartsWith(_NO_TRANSLATE_Remotes.Text, StringComparison.CurrentCultureIgnoreCase))
                            {
                                continue;
                            }

                            _heads.Insert(0, head);
                        }
                    }
                }

                Branches.DisplayMember = nameof(IGitRef.LocalName);

                ////_heads.Insert(0, GitHead.AllHeads); --> disable this because it is only for expert users
                _heads.Insert(0, GitRef.NoHead(Module));
                Branches.DataSource = _heads;

                Branches.ResizeDropDownWidth(AppSettings.BranchDropDownMinWidth, AppSettings.BranchDropDownMaxWidth);
            }
        }
Beispiel #22
0
        private void ViewSelectedFileDiff()
        {
            if (DiffFiles.SelectedItem == null)
            {
                diffViewer.ViewPatch("");
                return;
            }

            using (WaitCursorScope.Enter())
            {
                diffViewer.ViewChangesAsync(RevisionGrid.GetSelectedRevisions(), DiffFiles.SelectedItem, string.Empty);
            }
        }
        private void FormSettings_Shown(object sender, EventArgs e)
        {
            using (WaitCursorScope.Enter())
            {
                LoadSettings();

                if (_initialPage == null && _lastSelectedSettingsPageType != null)
                {
                    _initialPage = new SettingsPageReferenceByType(_lastSelectedSettingsPageType);
                }

                settingsTreeView.GotoPage(_initialPage);
            }
        }
Beispiel #24
0
        private void Skip_Click(object sender, EventArgs e)
        {
            using (WaitCursorScope.Enter())
            {
                var applyingPatch = patchGrid1.PatchFiles.FirstOrDefault(p => p.IsNext);
                if (applyingPatch != null)
                {
                    applyingPatch.IsSkipped = true;
                }

                FormProcess.ShowDialog(this, GitCommandHelpers.SkipCmd());
                EnableButtons();
            }
        }
Beispiel #25
0
        private void Skip_Click(object sender, EventArgs e)
        {
            using (WaitCursorScope.Enter())
            {
                var applyingPatch = patchGrid1.PatchFiles.FirstOrDefault(p => p.IsNext);
                if (applyingPatch != null)
                {
                    applyingPatch.IsSkipped = true;
                }

                FormProcess.ShowDialog(this, process: null, arguments: GitCommandHelpers.SkipCmd(), Module.WorkingDir, input: null, useDialogSettings: true);
                EnableButtons();
            }
        }
Beispiel #26
0
        private void StashSelectedFiles_Click(object sender, EventArgs e)
        {
            if (chkIncludeUntrackedFiles.Checked && !GitVersion.Current.StashUntrackedFilesSupported)
            {
                MessageBox.Show(_stashUntrackedFilesNotSupported.Text, _stashUntrackedFilesNotSupportedCaption.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            using (WaitCursorScope.Enter())
            {
                var msg = toolStripButton_customMessage.Checked ? " " + StashMessage.Text.Trim() : string.Empty;
                UICommands.StashSave(this, chkIncludeUntrackedFiles.Checked, StashKeepIndex.Checked, msg, Stashed.SelectedItems.Select(i => i.Name).ToList());
                Initialize();
            }
        }