Esempio n. 1
0
        internal async Task InitRepo()
        {
            await GitCommandWrappers.InitRepo(await GetSolutionFileName());

            SolutionExtensions.WriteMessageToOutputPane("Enabling SCC Provider");
            await OpenTracker();
            await EnableSccForSolution();
            await ReloadAllGlyphs();

            SolutionExtensions.WriteMessageToOutputPane("Done");
        }
 protected override async Task OnBranchSelection(string command)
 {
     var branch = CurrentRepository.GetBranchInfo(includeRemote: false)
                  .FirstOrDefault(x => string.Equals(x.Name, command, StringComparison.OrdinalIgnoreCase));
     var switchInfo = new SwitchBranchInfo()
     {
         BranchInfo = branch,
         Switch     = true,
         Repository = CurrentRepository
     };
     await GitCommandWrappers.SwitchCommand(switchInfo);
 }
        internal async Task SwitchCommand(SwitchBranchInfo branchInfo)
        {
            var switchResult = await GitCommandWrappers.SwitchCommand(branchInfo);

            if (switchResult.Succeeded)
            {
                await UpdateRepositoryName();
            }
            else
            {
                MessageBox.Show(switchResult.ErrorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
        internal async Task AmendCommit()
        {
            const string amendMsg = @"You are about to amend a commit that has tags or remotes, which could cause issues in local and remote repositories.

Are you sure you want to continue?";

            if (string.IsNullOrWhiteSpace(Comments))
            {
                Comments = CurrentTracker.LastCommitMessage;
                return;
            }
            else
            {
                if (CurrentTracker.CurrentCommitHasRefs() && MessageBox.Show(amendMsg, "Amend Last Commit",
                                                                             MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
                {
                    return;
                }

                var dte = BasicSccProvider.GetServiceEx <EnvDTE.DTE>();
                if (dte.ItemOperations.PromptToSave == EnvDTE.vsPromptResult.vsPromptResultCancelled)
                {
                    return;
                }

                StageSelectedFiles();

                try
                {
                    ShowStatusMessage("Amending last Commit ...");
                    var commitResult = await GitCommandWrappers.AmendCommit(CurrentTracker, Comments, chkSignOff.IsChecked == true);

                    if (commitResult.Succeeded)
                    {
                        ClearUI();
                        ShowStatusMessage("Amend last commit successfully. Commit Hash: " + commitResult.Item);
                    }
                    else
                    {
                        MessageBox.Show(commitResult.ErrorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    ShowStatusMessage(ex.Message);
                }
            }
        }
        protected override async Task OnBranchCommandSelection(string command)
        {
            if (string.Equals("Create Branch", command, StringComparison.OrdinalIgnoreCase))
            {
                var branchPicker = new BranchPicker(CurrentRepository);
                var branchInfo   = branchPicker.Show();

                var switchResult = await GitCommandWrappers.SwitchCommand(branchInfo);

                if (!switchResult.Succeeded)
                {
                    MessageBox.Show(switchResult.ErrorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
        }
Esempio n. 6
0
        internal async Task InitRepo()
        {
            await GitCommandWrappers.InitRepo(await GetSolutionFileName());

            SolutionExtensions.WriteMessageToOutputPane("Enabling SCC Provider");

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            var projects = await SolutionExtensions.GetLoadedControllableProjects();

            SolutionExtensions.WriteMessageToOutputPane("Adding Projects To git");
            foreach (var vsSccProject2 in projects)
            {
                await AddProjectToSourceControl(vsSccProject2);
            }
            await OpenTracker();
            await RefreshSolution();

            SolutionExtensions.WriteMessageToOutputPane("Done");
        }
        internal async Task Commit()
        {
            StageSelectedFiles();
            try
            {
                ShowStatusMessage("Committing ...");
                var commitResult = await GitCommandWrappers.Commit(CurrentTracker, Comments, chkSignOff.IsChecked == true);

                if (commitResult.Succeeded)
                {
                    ClearUI();
                }
                else
                {
                    MessageBox.Show(commitResult.ErrorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }