diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2012-03-12 19:09:24 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2012-03-12 19:09:24 +0400 |
commit | 493b2ae9e0f52972fe6c7b71d8060ba41699fb37 (patch) | |
tree | cf4795e35de01a602be1f6039c87453289e7f643 /main/src | |
parent | 79af4422664243836f400ff67513b0e2b27c9f1b (diff) | |
parent | 23ddc59cc5c7b4b631983ef8fd6d3913320286c9 (diff) |
Merge branch 'master' into newresolver
Diffstat (limited to 'main/src')
2 files changed, 12 insertions, 9 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs index 5edb903966..4091de5b51 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs @@ -80,7 +80,13 @@ namespace MonoDevelop.SourceEditor return; try { // Directory may have removed/unmounted. Therefore this operation is not guaranteed to work. - File.WriteAllText (GetAutoSaveFileName (fileName), content); + string tmpFile = Path.GetTempFileName (); + File.WriteAllText (tmpFile, content); + + var autosaveFileName = GetAutoSaveFileName (fileName); + if (File.Exists (autosaveFileName)) + File.Delete (autosaveFileName); + File.Move (tmpFile, autosaveFileName); Counters.AutoSavedFiles++; } catch (Exception e) { LoggingService.LogError ("Error in auto save while creating: " + fileName +". Disableing auto save.", e); diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs index 525c0d2610..a3f1e5d0f4 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs @@ -35,7 +35,7 @@ namespace MonoDevelop.VersionControl.Git { public class GitCredentials: CredentialsProvider { - DateTime LastAsked { + bool HasReset { get; set; } @@ -60,8 +60,7 @@ namespace MonoDevelop.VersionControl.Git if (TryGetUsernamePassword (uri, items, out passwordItem) || TryGetPassphrase (uri, items, out passphraseItem)) { // If the password store has a password and we already tried using it, it could be incorrect. // If this happens, do not return true and ask the user for a new password. - if (!ProbablyIncorrect ()) { - LastAsked = DateTime.Now; + if (!HasReset) { return true; } } @@ -75,7 +74,7 @@ namespace MonoDevelop.VersionControl.Git } }); - LastAsked = DateTime.Now; + HasReset = false; if (result) { if (passwordItem != null) { PasswordService.AddWebPassword (new Uri (uri.ToString ()), new string (passwordItem.GetValue ())); @@ -86,11 +85,9 @@ namespace MonoDevelop.VersionControl.Git return result; } - bool ProbablyIncorrect () + public override void Reset (URIish uri) { - // If we are queried multiple times in rapid succession it is probably - // because the supplied password is incorrect and we should dump it. - return (DateTime.Now - LastAsked) < TimeSpan.FromSeconds (2); + HasReset = true; } bool TryGetPassphrase (URIish uri, CredentialItem[] items, out CredentialItem.StringType passphraseItem) |