~ubuntu-branches/ubuntu/saucy/monodevelop/saucy-proposed

« back to all changes in this revision

Viewing changes to src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2010-09-10 16:54:48 UTC
  • mfrom: (19.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100910165448-0rybfk25zd4o9431
Tags: 2.4+dfsg-2
* debian/patches/inject_Mono.Debugger.Soft_source.patch,
  debian/patches/use_system_Mono.Debugger.Soft.patch,
  debian/control:
  + Build against system Soft Debugger, since we now have a new
    enough Mono to match MonoDevelop's required API

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
using System;
3
3
using System.Collections;
4
 
using System.Collections.Specialized;
5
4
using MonoDevelop.VersionControl.Dialogs;
6
 
using MonoDevelop.Ide.Gui;
7
5
using MonoDevelop.Core;
8
 
using MonoDevelop.Core.Gui;
 
6
using MonoDevelop.Ide;
9
7
 
10
8
namespace MonoDevelop.VersionControl
11
9
{
47
45
                                        if (!VersionControlService.NotifyPrepareCommit (vc, changeSet))
48
46
                                                return false;
49
47
                                        CommitDialog dlg = new CommitDialog (changeSet);
50
 
                                        dlg.TransientFor = IdeApp.Workbench.RootWindow;
51
48
                                        try {
52
 
                                                if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
 
49
                                                if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
53
50
                                                        if (VersionControlService.NotifyBeforeCommit (vc, changeSet)) {
54
51
                                                                new CommitWorker (vc, changeSet, dlg).Start();
55
52
                                                                return true;
77
74
                        Repository vc;
78
75
                        ChangeSet changeSet;
79
76
                        CommitDialog dlg;
 
77
                        bool success;
80
78
                                                
81
79
                        public CommitWorker (Repository vc, ChangeSet changeSet, CommitDialog dlg)
82
80
                        {
92
90
                        
93
91
                        protected override void Run ()
94
92
                        {
95
 
                                bool success = true;
 
93
                                success = true;
96
94
                                try {
97
 
                                        vc.Commit (changeSet, GetProgressMonitor ());
 
95
                                        vc.Commit (changeSet, Monitor);
 
96
                                        Monitor.ReportSuccess (GettextCatalog.GetString ("Commit operation completed."));
98
97
                                } catch {
99
98
                                        success = false;
100
99
                                        throw;
101
 
                                } finally {
102
 
                                        Gtk.Application.Invoke (delegate {
103
 
                                                dlg.EndCommit (success);
104
 
                                                dlg.Dispose ();
105
 
                                                VersionControlService.NotifyAfterCommit (vc, changeSet, success);
106
 
                                                ArrayList dirs = new ArrayList ();
107
 
                                                ArrayList files = new ArrayList ();
108
 
                                                foreach (ChangeSetItem it in changeSet.Items)
109
 
                                                        if (it.IsDirectory) dirs.Add (it.LocalPath);
110
 
                                                        else files.Add (it.LocalPath);
111
 
                                                foreach (FilePath path in dirs)
112
 
                                                        VersionControlService.NotifyFileStatusChanged (vc, path, true);
113
 
                                                foreach (FilePath path in files)
114
 
                                                        VersionControlService.NotifyFileStatusChanged (vc, path, false);
115
 
                                        });
116
100
                                }
117
101
                        }
 
102
                        
 
103
                        protected override void Finished ()
 
104
                        {
 
105
                                dlg.EndCommit (success);
 
106
                                dlg.Dispose ();
 
107
                                VersionControlService.NotifyAfterCommit (vc, changeSet, success);
 
108
                                ArrayList dirs = new ArrayList ();
 
109
                                ArrayList files = new ArrayList ();
 
110
                                foreach (ChangeSetItem it in changeSet.Items)
 
111
                                        if (it.IsDirectory) dirs.Add (it.LocalPath);
 
112
                                        else files.Add (it.LocalPath);
 
113
                                foreach (FilePath path in dirs)
 
114
                                        VersionControlService.NotifyFileStatusChanged (vc, path, true);
 
115
                                foreach (FilePath path in files)
 
116
                                        VersionControlService.NotifyFileStatusChanged (vc, path, false);
 
117
                        }
118
118
                }
119
119
        }
120
120
}