Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Suárez Ruiz <javiersuarezruiz@hotmail.com>2019-04-17 12:11:05 +0300
committerVsevolod Kukol <sevoku@microsoft.com>2019-05-02 15:05:00 +0300
commit9396815fbf9ae1649e65091cd7ed5c7375f1b151 (patch)
tree30d4fbb8e9ffa60362107ce159df7ca00dfbefb9 /main/src/addins/VersionControl
parent8ed8e77e95479b4377b8f409ccd2c715facbe667 (diff)
Changes to detect and save unsaved files included in the changeset too
Diffstat (limited to 'main/src/addins/VersionControl')
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs5
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs18
2 files changed, 16 insertions, 7 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs
index 9086f9a1c9..f2bd0698a2 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs
@@ -156,8 +156,9 @@ namespace MonoDevelop.VersionControl.Dialogs
{
if (vinfo != null && (vinfo.HasLocalChanges || vinfo.HasRemoteChanges)) {
changeSet.AddFile (vinfo.LocalPath);
- selected.Add (vinfo.LocalPath);
- AppendFileInfo (vinfo);
+ bool added = selected.Add (vinfo.LocalPath);
+ if(added)
+ AppendFileInfo (vinfo);
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs
index 699707dd85..55e5418238 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs
@@ -6,6 +6,7 @@ using MonoDevelop.Ide;
using System.Collections.Generic;
using System.Threading.Tasks;
using MonoDevelop.VersionControl.Dialogs;
+using System.Linq;
namespace MonoDevelop.VersionControl
{
@@ -38,21 +39,23 @@ namespace MonoDevelop.VersionControl
static async Task<bool> VerifyUnsavedChangesAsync (ChangeSet changeSet)
{
+ bool allowCommit = true;
// In case we have local unsaved files with changes, ask the user to save them.
List<Document> docList = new List<Document> ();
foreach (var item in IdeApp.Workbench.Documents) {
- if (item.IsDirty && !changeSet.ContainsFile(item.FileName))
+ if (item.IsDirty)
docList.Add (item);
}
if (docList.Count != 0) {
+ AlertButton dontSaveButton = new AlertButton (GettextCatalog.GetString ("Don't Save"));
AlertButton response = MessageService.GenericAlert (
Stock.Question,
GettextCatalog.GetString ("You are trying to commit files which have unsaved changes."),
GettextCatalog.GetString ("Do you want to save the changes before committing?"),
new AlertButton [] {
AlertButton.Cancel,
- new AlertButton (GettextCatalog.GetString ("Don't Save")),
+ dontSaveButton,
AlertButton.Save
}
);
@@ -61,10 +64,16 @@ namespace MonoDevelop.VersionControl
return false;
}
+ if (response == dontSaveButton) {
+ allowCommit = true;
+ }
+
if (response == AlertButton.Save) {
// Go through all the items and save them.
foreach (var item in docList) {
await item.Save ();
+ if (!changeSet.ContainsFile (item.FileName) && allowCommit)
+ allowCommit = false;
}
// Check if save failed on any item.
@@ -72,15 +81,14 @@ namespace MonoDevelop.VersionControl
if (item.IsDirty) {
MessageService.ShowMessage (GettextCatalog.GetString (
"Some files could not be saved."));
- break;
+ return false;
}
- return false;
}
docList.Clear ();
}
- return true;
+ return allowCommit;
}
private class CommitWorker : VersionControlTask