private void Commit()
        {
            var changes = IncludedChanges.Select(c => c.FilePath).ToList();

            if (!changes.Any())
            {
                return;
            }

            try
            {
                Provider.Stage(changes);
                Provider.Commit(CommitMessage);

                if (CommitAction == CommitAction.CommitAndSync)
                {
                    Provider.Pull();
                    Provider.Push();
                }

                if (CommitAction == CommitAction.CommitAndPush)
                {
                    Provider.Push();
                }

                RefreshView();
            }
            catch (SourceControlException ex)
            {
                RaiseErrorEvent(ex.Message, ex.InnerException.Message);
            }

            CommitMessage = string.Empty;
        }
Ejemplo n.º 2
0
        private void Commit()
        {
            Logger.Trace("Committing");

            var changes = IncludedChanges.Select(c => c.FilePath).ToList();

            if (!changes.Any())
            {
                return;
            }

            try
            {
                Provider.Stage(changes);
                Provider.Commit(CommitMessage);

                if (CommitAction == CommitAction.CommitAndSync)
                {
                    Logger.Trace("Commit and sync (pull + push)");
                    Provider.Pull();
                    Provider.Push();
                }

                if (CommitAction == CommitAction.CommitAndPush)
                {
                    Logger.Trace("Commit and push");
                    Provider.Push();
                }

                RefreshView();

                switch (CommitAction)
                {
                case CommitAction.Commit:
                    RaiseErrorEvent(RubberduckUI.SourceControl_CommitStatus, RubberduckUI.SourceControl_CommitStatus_CommitSuccess, NotificationType.Info);
                    return;

                case CommitAction.CommitAndPush:
                    RaiseErrorEvent(RubberduckUI.SourceControl_CommitStatus, RubberduckUI.SourceControl_CommitStatus_CommitAndPushSuccess, NotificationType.Info);
                    return;

                case CommitAction.CommitAndSync:
                    RaiseErrorEvent(RubberduckUI.SourceControl_CommitStatus, RubberduckUI.SourceControl_CommitStatus_CommitAndSyncSuccess, NotificationType.Info);
                    return;
                }
            }
            catch (SourceControlException ex)
            {
                RaiseErrorEvent(ex.Message, ex.InnerException, NotificationType.Error);
            }
            catch
            {
                RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
                                RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
                throw;
            }

            CommitMessage = string.Empty;
        }