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:
Diffstat (limited to 'main/src/addins/VersionControl')
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs24
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs44
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitNodeBuilderExtension.cs14
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs210
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs20
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitSupportFeature.cs11
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs3
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Stash.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/StashManagerDialog.cs8
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/LibSvnClient.cs53
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs606
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionRepository.cs47
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionVersionControl.cs49
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs56
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/AddRemoveMoveCommand.cs6
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs6
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/IgnoreCommand.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/LockCommand.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/PublishCommand.cs6
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs89
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/RevertCommand.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/RevertRevisionsCommands.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnknownRepository.cs24
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnlockCommand.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UpdateCommand.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlCommandHandler.cs6
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs10
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlItem.cs6
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs12
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs37
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlTask.cs (renamed from main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Task.cs)10
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml2
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs224
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj22
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/packages.config4
40 files changed, 866 insertions, 773 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs
index 8841f269d3..a87f73024f 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs
@@ -155,7 +155,7 @@ namespace MonoDevelop.VersionControl.Git.Tests
protected override void PostCommit (Repository repo)
{
var repo2 = (GitRepository)repo;
- repo2.Push (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), repo2.GetCurrentRemote (), repo2.GetCurrentBranch ());
+ repo2.Push (new MonoDevelop.Core.ProgressMonitor (), repo2.GetCurrentRemote (), repo2.GetCurrentBranch ());
}
protected override void BlameExtraInternals (Annotation [] annotations)
@@ -193,19 +193,19 @@ namespace MonoDevelop.VersionControl.Git.Tests
AddFile ("file1", "text", true, true);
repo2.CreateBranch ("branch1", null);
- repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "branch1");
+ repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitor (), "branch1");
Assert.AreEqual ("branch1", repo2.GetCurrentBranch ());
Assert.IsTrue (File.Exists (LocalPath + "file1"), "Branch not inheriting from current.");
AddFile ("file2", "text", true, false);
repo2.CreateBranch ("branch2", null);
- repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "branch2");
+ repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitor (), "branch2");
Assert.IsTrue (!File.Exists (LocalPath + "file2"), "Uncommitted changes were not stashed");
repo2.GetStashes ().Pop (new NullProgressMonitor ());
Assert.IsTrue (File.Exists (LocalPath + "file2"), "Uncommitted changes were not stashed correctly");
- repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "master");
+ repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitor (), "master");
repo2.RemoveBranch ("branch1");
Assert.IsFalse (repo2.GetBranches ().Any (b => b.Name == "branch1"), "Failed to delete branch");
@@ -224,14 +224,14 @@ namespace MonoDevelop.VersionControl.Git.Tests
PostCommit (repo2);
repo2.CreateBranch ("branch3", null);
- repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "branch3");
+ repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitor (), "branch3");
AddFile ("file2", "asdf", true, true);
- repo2.Push (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "origin", "branch3");
+ repo2.Push (new MonoDevelop.Core.ProgressMonitor (), "origin", "branch3");
- repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "master");
+ repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitor (), "master");
repo2.CreateBranch ("branch4", "origin/branch3");
- repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "branch4");
+ repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitor (), "branch4");
Assert.IsTrue (File.Exists (LocalPath + "file2"), "Tracking remote is not grabbing correct commits");
}
@@ -306,7 +306,7 @@ namespace MonoDevelop.VersionControl.Git.Tests
AddFile ("file1", "text", true, true);
PostCommit (repo2);
repo2.CreateBranch ("branch1", null);
- repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "branch1");
+ repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitor (), "branch1");
AddFile ("file2", "text", true, true);
PostCommit (repo2);
Assert.AreEqual (2, repo2.GetBranches ().Count ());
@@ -329,12 +329,12 @@ namespace MonoDevelop.VersionControl.Git.Tests
Assert.IsTrue (repo2.IsBranchMerged ("master"));
repo2.CreateBranch ("branch1", null);
- repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "branch1");
+ repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitor (), "branch1");
AddFile ("file2", "text", true, true);
- repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "master");
+ repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitor (), "master");
Assert.IsFalse (repo2.IsBranchMerged ("branch1"));
- repo2.Merge ("branch1", GitUpdateOptions.NormalUpdate, new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor ());
+ repo2.Merge ("branch1", GitUpdateOptions.NormalUpdate, new MonoDevelop.Core.ProgressMonitor ());
Assert.IsTrue (repo2.IsBranchMerged ("branch1"));
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs
index ba74fd3e0e..648cc45fdb 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs
@@ -242,15 +242,15 @@ namespace MonoDevelop.VersionControl.Tests
Repo2 = GetRepo (second, RemoteUrl);
string added = second + "testfile2";
File.Create (added).Close ();
- Repo2.Add (added, false, new NullProgressMonitor ());
+ Repo2.Add (added, false, new ProgressMonitor ());
ChangeSet changes = Repo.CreateChangeSet (Repo.RootPath);
changes.AddFile (Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache));
changes.GlobalComment = "test2";
- Repo2.Commit (changes, new NullProgressMonitor ());
+ Repo2.Commit (changes, new ProgressMonitor ());
PostCommit (Repo2);
- Repo.Update (Repo.RootPath, true, new NullProgressMonitor ());
+ Repo.Update (Repo.RootPath, true, new ProgressMonitor ());
Assert.True (File.Exists (LocalPath + "testfile2"));
DeleteDirectory (second);
@@ -290,7 +290,7 @@ namespace MonoDevelop.VersionControl.Tests
// Revert to head.
File.WriteAllText (added, content);
- Repo.Revert (added, false, new NullProgressMonitor ());
+ Repo.Revert (added, false, new ProgressMonitor ());
Assert.AreEqual (Repo.GetBaseText (added), File.ReadAllText (added));
}
@@ -317,7 +317,7 @@ namespace MonoDevelop.VersionControl.Tests
string added = LocalPath + "testfile2";
AddFile ("testfile", "text", true, true);
AddFile ("testfile2", "text2", true, true);
- Repo.RevertRevision (added, GetHeadRevision (), new NullProgressMonitor ());
+ Repo.RevertRevision (added, GetHeadRevision (), new ProgressMonitor ());
Assert.IsFalse (File.Exists (added));
}
@@ -334,7 +334,7 @@ namespace MonoDevelop.VersionControl.Tests
AddFile ("testfile", null, true, true);
src = LocalPath + "testfile";
dst = src + "2";
- Repo.MoveFile (src, dst, false, new NullProgressMonitor ());
+ Repo.MoveFile (src, dst, false, new ProgressMonitor ());
srcVi = Repo.GetVersionInfo (src, VersionInfoQueryFlags.IgnoreCache);
dstVi = Repo.GetVersionInfo (dst, VersionInfoQueryFlags.IgnoreCache);
const VersionStatus versionedStatus = VersionStatus.ScheduledDelete | VersionStatus.ScheduledReplace;
@@ -345,7 +345,7 @@ namespace MonoDevelop.VersionControl.Tests
AddFile ("addedfile", null, true, false);
src = LocalPath + "addedfile";
dst = src + "2";
- Repo.MoveFile (src, dst, false, new NullProgressMonitor ());
+ Repo.MoveFile (src, dst, false, new ProgressMonitor ());
srcVi = Repo.GetVersionInfo (src, VersionInfoQueryFlags.IgnoreCache);
dstVi = Repo.GetVersionInfo (dst, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.Unversioned, srcVi.Status);
@@ -355,7 +355,7 @@ namespace MonoDevelop.VersionControl.Tests
AddFile ("unversionedfile", null, false, false);
src = LocalPath + "unversionedfile";
dst = src + "2";
- Repo.MoveFile (src, dst, false, new NullProgressMonitor ());
+ Repo.MoveFile (src, dst, false, new ProgressMonitor ());
srcVi = Repo.GetVersionInfo (src, VersionInfoQueryFlags.IgnoreCache);
dstVi = Repo.GetVersionInfo (dst, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.Unversioned, srcVi.Status);
@@ -374,7 +374,7 @@ namespace MonoDevelop.VersionControl.Tests
AddDirectory ("test", true, false);
AddFile ("test" + Path.DirectorySeparatorChar + "testfile", null, true, true);
- Repo.MoveDirectory (srcDir, dstDir, false, new NullProgressMonitor ());
+ Repo.MoveDirectory (srcDir, dstDir, false, new ProgressMonitor ());
VersionInfo srcVi = Repo.GetVersionInfo (src, VersionInfoQueryFlags.IgnoreCache);
VersionInfo dstVi = Repo.GetVersionInfo (dst, VersionInfoQueryFlags.IgnoreCache);
const VersionStatus expectedStatus = VersionStatus.ScheduledDelete | VersionStatus.ScheduledReplace;
@@ -390,7 +390,7 @@ namespace MonoDevelop.VersionControl.Tests
// Versioned file.
added = LocalPath + "testfile1" + postFix;
AddFile ("testfile1" + postFix, null, true, true);
- Repo.DeleteFile (added, true, new NullProgressMonitor (), keepLocal);
+ Repo.DeleteFile (added, true, new ProgressMonitor (), keepLocal);
vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.ScheduledDelete, vi.Status & VersionStatus.ScheduledDelete);
Assert.AreEqual (keepLocal, File.Exists (added));
@@ -398,7 +398,7 @@ namespace MonoDevelop.VersionControl.Tests
// Just added file.
added = LocalPath + "testfile2" + postFix;
AddFile ("testfile2" + postFix, null, true, false);
- Repo.DeleteFile (added, true, new NullProgressMonitor (), keepLocal);
+ Repo.DeleteFile (added, true, new ProgressMonitor (), keepLocal);
vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.Unversioned, vi.Status);
Assert.AreEqual (keepLocal, File.Exists (added));
@@ -406,7 +406,7 @@ namespace MonoDevelop.VersionControl.Tests
// Non versioned file.
added = LocalPath + "testfile3" + postFix;
AddFile ("testfile3" + postFix, null, false, false);
- Repo.DeleteFile (added, true, new NullProgressMonitor (), keepLocal);
+ Repo.DeleteFile (added, true, new ProgressMonitor (), keepLocal);
vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.Unversioned, vi.Status);
Assert.AreEqual (keepLocal, File.Exists (added));
@@ -433,7 +433,7 @@ namespace MonoDevelop.VersionControl.Tests
AddDirectory ("test1" + postFix, true, false);
AddFile ("test1" + postFix + Path.DirectorySeparatorChar + "testfile", null, true, true);
- Repo.DeleteDirectory (addedDir, true, new NullProgressMonitor (), keepLocal);
+ Repo.DeleteDirectory (addedDir, true, new ProgressMonitor (), keepLocal);
vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.ScheduledDelete, vi.Status & VersionStatus.ScheduledDelete);
Assert.AreEqual (keepLocal, File.Exists (added));
@@ -444,7 +444,7 @@ namespace MonoDevelop.VersionControl.Tests
AddDirectory ("test2" + postFix, true, false);
AddFile ("test2" + postFix + Path.DirectorySeparatorChar + "testfile", null, true, false);
- Repo.DeleteDirectory (addedDir, true, new NullProgressMonitor (), keepLocal);
+ Repo.DeleteDirectory (addedDir, true, new ProgressMonitor (), keepLocal);
vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.Unversioned, vi.Status);
Assert.AreEqual (keepLocal, File.Exists (added));
@@ -455,7 +455,7 @@ namespace MonoDevelop.VersionControl.Tests
AddDirectory ("test3" + postFix, true, false);
AddFile ("test3" + postFix + Path.DirectorySeparatorChar + "testfile", null, false, false);
- Repo.DeleteDirectory (addedDir, true, new NullProgressMonitor (), keepLocal);
+ Repo.DeleteDirectory (addedDir, true, new ProgressMonitor (), keepLocal);
vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.Unversioned, vi.Status);
Assert.AreEqual (keepLocal, File.Exists (added));
@@ -475,7 +475,7 @@ namespace MonoDevelop.VersionControl.Tests
{
string added = LocalPath + "testfile";
AddFile ("testfile", null, true, true);
- Repo.Lock (new NullProgressMonitor (), added);
+ Repo.Lock (new ProgressMonitor (), added);
PostLock ();
}
@@ -490,8 +490,8 @@ namespace MonoDevelop.VersionControl.Tests
{
string added = LocalPath + "testfile";
AddFile ("testfile", null, true, true);
- Repo.Lock (new NullProgressMonitor (), "testfile");
- Repo.Unlock (new NullProgressMonitor (), added);
+ Repo.Lock (new ProgressMonitor (), "testfile");
+ Repo.Unlock (new ProgressMonitor (), added);
PostLock ();
}
@@ -575,7 +575,7 @@ namespace MonoDevelop.VersionControl.Tests
protected void Checkout (string path, string url)
{
Repository _repo = GetRepo (path, url);
- _repo.Checkout (path, true, new NullProgressMonitor ());
+ _repo.Checkout (path, true, new ProgressMonitor ());
if (Repo == null)
Repo = _repo;
else
@@ -589,7 +589,7 @@ namespace MonoDevelop.VersionControl.Tests
changes.AddFile (Repo.GetVersionInfo (item, VersionInfoQueryFlags.IgnoreCache));
}
changes.GlobalComment = String.Format ("Commit #{0}", CommitNumber);
- Repo.Commit (changes, new NullProgressMonitor ());
+ Repo.Commit (changes, new ProgressMonitor ());
CommitNumber++;
}
@@ -603,7 +603,7 @@ namespace MonoDevelop.VersionControl.Tests
changes.AddFile (Repo.GetVersionInfo (path, VersionInfoQueryFlags.IgnoreCache));
changes.GlobalComment = String.Format ("Commit #{0}", CommitNumber);
- Repo.Commit (changes, new NullProgressMonitor ());
+ Repo.Commit (changes, new ProgressMonitor ());
CommitNumber++;
}
@@ -626,7 +626,7 @@ namespace MonoDevelop.VersionControl.Tests
File.WriteAllText (added, contents);
if (toVcs)
- Repo.Add (added, false, new NullProgressMonitor ());
+ Repo.Add (added, false, new ProgressMonitor ());
if (commit)
CommitFile (added);
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
index b624b70f0e..72d67d950a 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
@@ -50,7 +50,7 @@ namespace MonoDevelop.VersionControl.Git
{
public GitRepository Repository {
get {
- IWorkspaceObject wob = IdeApp.ProjectOperations.CurrentSelectedSolutionItem;
+ WorkspaceObject wob = IdeApp.ProjectOperations.CurrentSelectedSolutionItem;
if (wob == null)
wob = IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem;
if (wob != null)
@@ -86,7 +86,7 @@ namespace MonoDevelop.VersionControl.Git
if (repo == null)
return;
- IWorkspaceObject wob = IdeApp.ProjectOperations.CurrentSelectedItem as IWorkspaceObject;
+ WorkspaceObject wob = IdeApp.ProjectOperations.CurrentSelectedItem as WorkspaceObject;
if (wob == null)
return;
if (((wob is WorkspaceItem) && ((WorkspaceItem)wob).ParentWorkspace == null) ||
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitNodeBuilderExtension.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitNodeBuilderExtension.cs
index 6f008faa03..03561045fe 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitNodeBuilderExtension.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitNodeBuilderExtension.cs
@@ -35,7 +35,7 @@ namespace MonoDevelop.VersionControl.Git
{
sealed class GitNodeBuilderExtension: NodeBuilderExtension
{
- readonly Dictionary<FilePath,IWorkspaceObject> repos = new Dictionary<FilePath, IWorkspaceObject> ();
+ readonly Dictionary<FilePath,WorkspaceObject> repos = new Dictionary<FilePath, WorkspaceObject> ();
protected override void Initialize ()
{
@@ -53,15 +53,15 @@ namespace MonoDevelop.VersionControl.Git
public override bool CanBuildNode (Type dataType)
{
- return typeof(IWorkspaceObject).IsAssignableFrom (dataType);
+ return typeof(WorkspaceObject).IsAssignableFrom (dataType);
}
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
- IWorkspaceObject ob = (IWorkspaceObject) dataObject;
+ WorkspaceObject ob = (WorkspaceObject) dataObject;
GitRepository rep = VersionControlService.GetRepository (ob) as GitRepository;
if (rep != null) {
- IWorkspaceObject rob;
+ WorkspaceObject rob;
if (repos.TryGetValue (rep.RootPath.CanonicalPath, out rob)) {
if (ob == rob)
nodeInfo.Label += " (" + rep.GetCurrentBranch () + ")";
@@ -71,7 +71,7 @@ namespace MonoDevelop.VersionControl.Git
public override void OnNodeAdded (object dataObject)
{
- IWorkspaceObject ob = (IWorkspaceObject) dataObject;
+ WorkspaceObject ob = (WorkspaceObject) dataObject;
GitRepository rep = VersionControlService.GetRepository (ob) as GitRepository;
if (rep != null && !repos.ContainsKey (rep.RootPath.CanonicalPath)) {
repos [rep.RootPath] = ob;
@@ -80,9 +80,9 @@ namespace MonoDevelop.VersionControl.Git
public override void OnNodeRemoved (object dataObject)
{
- IWorkspaceObject ob = (IWorkspaceObject) dataObject;
+ WorkspaceObject ob = (WorkspaceObject) dataObject;
GitRepository rep = VersionControlService.GetRepository (ob) as GitRepository;
- IWorkspaceObject rob;
+ WorkspaceObject rob;
if (rep != null && repos.TryGetValue (rep.RootPath.CanonicalPath, out rob)) {
if (ob == rob)
repos.Remove (rep.RootPath.CanonicalPath);
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
index 144e81b7ce..83725fb1d1 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
@@ -44,6 +44,7 @@ using NGit.Transport;
using NGit.Diff;
using NGit.Merge;
using NGit.Submodule;
+using ProgressMonitor = MonoDevelop.Core.ProgressMonitor;
namespace MonoDevelop.VersionControl.Git
{
@@ -409,7 +410,7 @@ namespace MonoDevelop.VersionControl.Git
.Select (f => new FilePath (f).CanonicalPath));
}
- protected override Repository OnPublish (string serverPath, FilePath localPath, FilePath[] files, string message, IProgressMonitor monitor)
+ protected override Repository OnPublish (string serverPath, FilePath localPath, FilePath[] files, string message, ProgressMonitor monitor)
{
// Initialize the repository
RootRepository = GitUtil.Init (localPath, Url);
@@ -451,7 +452,7 @@ namespace MonoDevelop.VersionControl.Git
return this;
}
- protected override void OnUpdate (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
+ protected override void OnUpdate (FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
{
IEnumerable<DiffEntry> statusList = null;
@@ -478,7 +479,7 @@ namespace MonoDevelop.VersionControl.Git
monitor.EndTask ();
}
- public void Fetch (IProgressMonitor monitor)
+ public void Fetch (ProgressMonitor monitor)
{
string remote = GetCurrentRemote ();
if (remote == null)
@@ -536,7 +537,7 @@ namespace MonoDevelop.VersionControl.Git
return true;
}
- public void Rebase (string upstreamRef, GitUpdateOptions options, IProgressMonitor monitor)
+ public void Rebase (string upstreamRef, GitUpdateOptions options, ProgressMonitor monitor)
{
StashCollection stashes = GitUtil.GetStashes (RootRepository);
Stash stash = null;
@@ -660,7 +661,7 @@ namespace MonoDevelop.VersionControl.Git
}
}
- public void Merge (string branch, GitUpdateOptions options, IProgressMonitor monitor)
+ public void Merge (string branch, GitUpdateOptions options, ProgressMonitor monitor)
{
IEnumerable<DiffEntry> statusList = null;
Stash stash = null;
@@ -798,7 +799,7 @@ namespace MonoDevelop.VersionControl.Git
return res;
}
- protected override void OnCommit (ChangeSet changeSet, IProgressMonitor monitor)
+ protected override void OnCommit (ChangeSet changeSet, ProgressMonitor monitor)
{
string message = changeSet.GlobalComment;
if (string.IsNullOrEmpty (message))
@@ -864,7 +865,7 @@ namespace MonoDevelop.VersionControl.Git
config.Save ();
}
- protected override void OnCheckout (FilePath targetLocalPath, Revision rev, bool recurse, IProgressMonitor monitor)
+ protected override void OnCheckout (FilePath targetLocalPath, Revision rev, bool recurse, ProgressMonitor monitor)
{
CloneCommand cmd = NGit.Api.Git.CloneRepository ();
cmd.SetURI (Url);
@@ -889,108 +890,109 @@ namespace MonoDevelop.VersionControl.Git
}
}
- protected override void OnRevert (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
+ protected override void OnRevert (FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
{
// Replace with NGit.Api.Git.Reset ()
+
// FIXME: we lack info about what happened to files
- foreach (var group in GroupByRepository (localPaths)) {
+
+ var groups = GroupByRepository (localPaths).ToArray ();
+ monitor.BeginTask (GettextCatalog.GetString ("Reverting files"), groups.Length);
+
+ foreach (var group in groups) {
+ monitor.BeginStep (1);
var repository = group.Key;
var files = group.ToArray ();
- var c = GetHeadCommit (repository);
- RevTree tree = c != null ? c.Tree : null;
-
- List<FilePath> changedFiles = new List<FilePath> ();
- List<FilePath> removedFiles = new List<FilePath> ();
-
- monitor.BeginTask (GettextCatalog.GetString ("Reverting files"), 3);
- monitor.BeginStepTask (GettextCatalog.GetString ("Reverting files"), files.Length, 2);
-
- DirCache dc = repository.LockDirCache ();
- DirCacheBuilder builder = dc.Builder ();
-
- try {
- HashSet<string> entriesToRemove = new HashSet<string> ();
- HashSet<string> foldersToRemove = new HashSet<string> ();
+ var c = GetHeadCommit (repository);
+ RevTree tree = c != null ? c.Tree : null;
- // Add the new entries
- foreach (FilePath fp in files) {
- string p = repository.ToGitPath (fp);
-
- // Register entries to be removed from the index
- if (Directory.Exists (fp))
- foldersToRemove.Add (p);
- else
- entriesToRemove.Add (p);
+ List<FilePath> changedFiles = new List<FilePath> ();
+ List<FilePath> removedFiles = new List<FilePath> ();
+
+ monitor.BeginTask (files.Length);
+
+ DirCache dc = repository.LockDirCache ();
+ DirCacheBuilder builder = dc.Builder ();
+
+ try {
+ HashSet<string> entriesToRemove = new HashSet<string> ();
+ HashSet<string> foldersToRemove = new HashSet<string> ();
- TreeWalk tw = tree != null ? TreeWalk.ForPath (repository, p, tree) : null;
- if (tw == null) {
- // Removed from the index
- }
- else {
- // Add new entries
+ // Add the new entries
+ foreach (FilePath fp in files) {
+ string p = repository.ToGitPath (fp);
- TreeWalk r;
- if (tw.IsSubtree) {
- // It's a directory. Make sure we remove existing index entries of this directory
+ // Register entries to be removed from the index
+ if (Directory.Exists (fp))
foldersToRemove.Add (p);
+ else
+ entriesToRemove.Add (p);
+
+ TreeWalk tw = tree != null ? TreeWalk.ForPath (repository, p, tree) : null;
+ if (tw == null) {
+ // Removed from the index
+ }
+ else {
+ // Add new entries
- // We have to iterate through all folder files. We need a new iterator since the
- // existing rw is not recursive
- r = new TreeWalk(repository);
- r.Reset (tree);
- r.Filter = PathFilterGroup.CreateFromStrings(new string[]{p});
- r.Recursive = true;
- r.Next ();
- } else {
- r = tw;
+ TreeWalk r;
+ if (tw.IsSubtree) {
+ // It's a directory. Make sure we remove existing index entries of this directory
+ foldersToRemove.Add (p);
+
+ // We have to iterate through all folder files. We need a new iterator since the
+ // existing rw is not recursive
+ r = new TreeWalk(repository);
+ r.Reset (tree);
+ r.Filter = PathFilterGroup.CreateFromStrings(new string[]{p});
+ r.Recursive = true;
+ r.Next ();
+ } else {
+ r = tw;
+ }
+
+ do {
+ // There can be more than one entry if reverting a whole directory
+ string rpath = repository.FromGitPath (r.PathString);
+ DirCacheEntry e = new DirCacheEntry (r.PathString);
+ e.SetObjectId (r.GetObjectId (0));
+ e.FileMode = r.GetFileMode (0);
+ if (!Directory.Exists (Path.GetDirectoryName (rpath)))
+ Directory.CreateDirectory (rpath);
+ DirCacheCheckout.CheckoutEntry (repository, rpath, e);
+ builder.Add (e);
+ changedFiles.Add (rpath);
+ } while (r.Next ());
}
-
- do {
- // There can be more than one entry if reverting a whole directory
- string rpath = repository.FromGitPath (r.PathString);
- DirCacheEntry e = new DirCacheEntry (r.PathString);
- e.SetObjectId (r.GetObjectId (0));
- e.FileMode = r.GetFileMode (0);
- if (!Directory.Exists (Path.GetDirectoryName (rpath)))
- Directory.CreateDirectory (rpath);
- DirCacheCheckout.CheckoutEntry (repository, rpath, e);
+ }
+
+ // Add entries we want to keep
+ int count = dc.GetEntryCount ();
+ for (int n=0; n<count; n++) {
+ DirCacheEntry e = dc.GetEntry (n);
+ string path = e.PathString;
+ if (!entriesToRemove.Contains (path) && !foldersToRemove.Any (f => IsSubpath (f,path)))
builder.Add (e);
- changedFiles.Add (rpath);
- } while (r.Next ());
}
+
+ builder.Commit ();
monitor.Step (1);
}
-
- // Add entries we want to keep
- int count = dc.GetEntryCount ();
- for (int n=0; n<count; n++) {
- DirCacheEntry e = dc.GetEntry (n);
- string path = e.PathString;
- if (!entriesToRemove.Contains (path) && !foldersToRemove.Any (f => IsSubpath (f,path)))
- builder.Add (e);
+ catch {
+ dc.Unlock ();
+ throw;
}
- builder.Commit ();
- }
- catch {
- dc.Unlock ();
- throw;
- }
-
- monitor.EndTask ();
- monitor.BeginTask (null, files.Length);
+ foreach (FilePath p in changedFiles)
+ FileService.NotifyFileChanged (p, true);
- foreach (FilePath p in changedFiles) {
- FileService.NotifyFileChanged (p, true);
- monitor.Step (1);
- }
- foreach (FilePath p in removedFiles) {
- FileService.NotifyFileRemoved (p);
- monitor.Step (1);
+ foreach (FilePath p in removedFiles)
+ FileService.NotifyFileRemoved (p);
+
+ monitor.EndTask ();
}
monitor.EndTask ();
- }
}
static bool IsSubpath (string basePath, string childPath)
@@ -1001,12 +1003,12 @@ namespace MonoDevelop.VersionControl.Git
return childPath.StartsWith (basePath + "/", StringComparison.InvariantCulture);
}
- protected override void OnRevertRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
+ protected override void OnRevertRevision (FilePath localPath, Revision revision, ProgressMonitor monitor)
{
throw new NotSupportedException ();
}
- protected override void OnRevertToRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
+ protected override void OnRevertToRevision (FilePath localPath, Revision revision, ProgressMonitor monitor)
{
NGit.Repository repo = GetRepository (localPath);
NGit.Api.Git git = new NGit.Api.Git (repo);
@@ -1020,7 +1022,7 @@ namespace MonoDevelop.VersionControl.Git
}
- protected override void OnAdd (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
+ protected override void OnAdd (FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
{
foreach (var group in GroupByRepository (localPaths)) {
var repository = group.Key;
@@ -1034,7 +1036,7 @@ namespace MonoDevelop.VersionControl.Git
}
}
- protected override void OnDeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
+ protected override void OnDeleteFiles (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal)
{
DeleteCore (localPaths, force, monitor, keepLocal);
@@ -1054,7 +1056,7 @@ namespace MonoDevelop.VersionControl.Git
}
}
- protected override void OnDeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
+ protected override void OnDeleteDirectories (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal)
{
DeleteCore (localPaths, force, monitor, keepLocal);
@@ -1076,7 +1078,7 @@ namespace MonoDevelop.VersionControl.Git
}
}
- void DeleteCore (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
+ void DeleteCore (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal)
{
foreach (var group in GroupByRepository (localPaths)) {
List<FilePath> backupFiles = new List<FilePath> ();
@@ -1220,7 +1222,7 @@ namespace MonoDevelop.VersionControl.Git
return remotes[0];
}
- public void Push (IProgressMonitor monitor, string remote, string remoteBranch)
+ public void Push (ProgressMonitor monitor, string remote, string remoteBranch)
{
string remoteRef = "refs/heads/" + remoteBranch;
IEnumerable<PushResult> res;
@@ -1422,7 +1424,7 @@ namespace MonoDevelop.VersionControl.Git
return RootRepository.GetBranch ();
}
- public void SwitchToBranch (IProgressMonitor monitor, string branch)
+ public void SwitchToBranch (ProgressMonitor monitor, string branch)
{
monitor.BeginTask (GettextCatalog.GetString ("Switching to branch {0}", branch), GitService.StashUnstashWhenSwitchingBranches ? 4 : 2);
@@ -1477,7 +1479,7 @@ namespace MonoDevelop.VersionControl.Git
monitor.EndTask ();
}
- void NotifyFileChanges (IProgressMonitor monitor, IEnumerable<DiffEntry> statusList)
+ void NotifyFileChanges (ProgressMonitor monitor, IEnumerable<DiffEntry> statusList)
{
List<DiffEntry> changes = new List<DiffEntry> (statusList);
@@ -1575,7 +1577,7 @@ namespace MonoDevelop.VersionControl.Git
return diffs.ToArray ();
}
- protected override void OnMoveFile (FilePath localSrcPath, FilePath localDestPath, bool force, IProgressMonitor monitor)
+ protected override void OnMoveFile (FilePath localSrcPath, FilePath localDestPath, bool force, ProgressMonitor monitor)
{
VersionInfo vi = GetVersionInfo (localSrcPath, VersionInfoQueryFlags.IgnoreCache);
if (vi == null || !vi.IsVersioned) {
@@ -1589,7 +1591,7 @@ namespace MonoDevelop.VersionControl.Git
Revert (localSrcPath, false, monitor);
}
- protected override void OnMoveDirectory (FilePath localSrcPath, FilePath localDestPath, bool force, IProgressMonitor monitor)
+ protected override void OnMoveDirectory (FilePath localSrcPath, FilePath localDestPath, bool force, ProgressMonitor monitor)
{
VersionInfo[] versionedFiles = GetDirectoryVersionInfo (localSrcPath, false, true);
base.OnMoveDirectory (localSrcPath, localDestPath, force, monitor);
@@ -1767,21 +1769,21 @@ namespace MonoDevelop.VersionControl.Git
public string PushUrl { get; internal set; }
}
- class GitMonitor: ProgressMonitor, IDisposable
+ class GitMonitor: NGit.ProgressMonitor, IDisposable
{
- readonly IProgressMonitor monitor;
+ readonly MonoDevelop.Core.ProgressMonitor monitor;
int currentWork;
int currentStep;
bool taskStarted;
int totalTasksOverride = -1;
bool monitorStarted;
- public GitMonitor (IProgressMonitor monitor)
+ public GitMonitor (MonoDevelop.Core.ProgressMonitor monitor)
{
this.monitor = monitor;
}
- public GitMonitor (IProgressMonitor monitor, int totalTasksOverride)
+ public GitMonitor (MonoDevelop.Core.ProgressMonitor monitor, int totalTasksOverride)
{
this.monitor = monitor;
this.totalTasksOverride = totalTasksOverride;
@@ -1829,7 +1831,7 @@ namespace MonoDevelop.VersionControl.Git
public override bool IsCancelled ()
{
- return monitor.IsCancelRequested;
+ return monitor.CancellationToken.IsCancellationRequested;
}
public void Dispose ()
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
index 41ffac25fd..6b7d86cf14 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
@@ -30,6 +30,7 @@ using MonoDevelop.Ide;
using MonoDevelop.Ide.ProgressMonitoring;
using NGit.Api;
using System.Threading;
+using System.Threading.Tasks;
namespace MonoDevelop.VersionControl.Git
{
@@ -63,7 +64,7 @@ namespace MonoDevelop.VersionControl.Git
string remote = dlg.SelectedRemote;
string branch = dlg.SelectedRemoteBranch ?? repo.GetCurrentBranch ();
- IProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Pushing changes..."), VersionControlOperationType.Push);
+ ProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Pushing changes..."), VersionControlOperationType.Push);
ThreadPool.QueueUserWorkItem (delegate {
try {
repo.Push (monitor, remote, branch);
@@ -91,13 +92,13 @@ namespace MonoDevelop.VersionControl.Git
if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
dlg.Hide ();
if (rebasing) {
- using (IProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Rebasing branch '{0}'...", dlg.SelectedBranch))) {
+ using (ProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Rebasing branch '{0}'...", dlg.SelectedBranch))) {
if (dlg.IsRemote)
repo.Fetch (monitor);
repo.Rebase (dlg.SelectedBranch, dlg.StageChanges ? GitUpdateOptions.SaveLocalChanges : GitUpdateOptions.None, monitor);
}
} else {
- using (IProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Merging branch '{0}'...", dlg.SelectedBranch))) {
+ using (ProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Merging branch '{0}'...", dlg.SelectedBranch))) {
if (dlg.IsRemote)
repo.Fetch (monitor);
repo.Merge (dlg.SelectedBranch, dlg.StageChanges ? GitUpdateOptions.SaveLocalChanges : GitUpdateOptions.None, monitor);
@@ -115,13 +116,13 @@ namespace MonoDevelop.VersionControl.Git
MessageService.ShowCustomDialog (dlg);
}
- public static void SwitchToBranch (GitRepository repo, string branch)
+ public async static void SwitchToBranch (GitRepository repo, string branch)
{
MessageDialogProgressMonitor monitor = new MessageDialogProgressMonitor (true, false, false, true);
try {
IdeApp.Workbench.AutoReloadDocuments = true;
IdeApp.Workbench.LockGui ();
- ThreadPool.QueueUserWorkItem (delegate {
+ await Task.Factory.StartNew (delegate {
try {
repo.SwitchToBranch (monitor, branch);
} catch (Exception ex) {
@@ -130,18 +131,17 @@ namespace MonoDevelop.VersionControl.Git
monitor.Dispose ();
}
});
- monitor.AsyncOperation.WaitForCompleted ();
} finally {
IdeApp.Workbench.AutoReloadDocuments = false;
IdeApp.Workbench.UnlockGui ();
}
}
- public static IAsyncOperation ApplyStash (Stash s)
+ public static Task ApplyStash (Stash s)
{
MessageDialogProgressMonitor monitor = new MessageDialogProgressMonitor (true, false, false, true);
var statusTracker = IdeApp.Workspace.GetFileStatusTracker ();
- ThreadPool.QueueUserWorkItem (delegate {
+ var t = Task.Factory.StartNew (delegate {
try {
MergeCommandResult result;
using (var gm = new GitMonitor (monitor))
@@ -156,10 +156,10 @@ namespace MonoDevelop.VersionControl.Git
statusTracker.NotifyChanges ();
}
});
- return monitor.AsyncOperation;
+ return t;
}
- public static void ReportStashResult (IProgressMonitor monitor, MergeCommandResult result)
+ public static void ReportStashResult (ProgressMonitor monitor, MergeCommandResult result)
{
if (result.GetMergeStatus () == MergeStatus.FAILED) {
string msg = GettextCatalog.GetString ("Stash operation failed.");
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitSupportFeature.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitSupportFeature.cs
index 437c28627f..9ee17b62cb 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitSupportFeature.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitSupportFeature.cs
@@ -27,31 +27,32 @@ using System;
using MonoDevelop.Ide.Templates;
using MonoDevelop.Core;
using MonoDevelop.Projects;
+using System.Linq;
namespace MonoDevelop.VersionControl.Git
{
sealed class GitSupportFeature: ISolutionItemFeature
{
- public FeatureSupportLevel GetSupportLevel (SolutionFolder parentFolder, SolutionItem entry)
+ public FeatureSupportLevel GetSupportLevel (SolutionFolder parentFolder, SolutionFolderItem entry)
{
if (parentFolder != null && !parentFolder.ParentSolution.FileName.IsNullOrEmpty && System.IO.File.Exists (parentFolder.ParentSolution.FileName))
return FeatureSupportLevel.NotSupported;
return FeatureSupportLevel.SupportedByDefault;
}
- public Gtk.Widget CreateFeatureEditor (SolutionFolder parentCombine, SolutionItem entry)
+ public Gtk.Widget CreateFeatureEditor (SolutionFolder parentCombine, SolutionFolderItem entry)
{
Gtk.Label label = new Gtk.Label (GettextCatalog.GetString ("A new local Git Repository for the solution will be created"));
label.Show ();
return label;
}
- public string Validate (SolutionFolder parentCombine, SolutionItem entry, Gtk.Widget editor)
+ public string Validate (SolutionFolder parentCombine, SolutionFolderItem entry, Gtk.Widget editor)
{
return null;
}
- public void ApplyFeature (SolutionFolder parentFolder, SolutionItem entry, Gtk.Widget editor)
+ public void ApplyFeature (SolutionFolder parentFolder, SolutionFolderItem entry, Gtk.Widget editor)
{
// The solution may not be saved yet
if (parentFolder.ParentSolution.FileName.IsNullOrEmpty || !System.IO.File.Exists (parentFolder.ParentSolution.FileName))
@@ -67,7 +68,7 @@ namespace MonoDevelop.VersionControl.Git
GitUtil.Init (sol.BaseDirectory, null);
GitRepository gitRepo = new GitRepository (sol.BaseDirectory, null);
- gitRepo.Add (sol.GetItemFiles (true).ToArray (), false, new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor ());
+ gitRepo.Add (sol.GetItemFiles (true).ToArray (), false, new MonoDevelop.Core.ProgressMonitor ());
}
public string Title {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs
index 2b56ef3e51..5ec0df4cbf 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs
@@ -38,6 +38,7 @@ using NGit.Transport;
using NGit.Diff;
using NGit.Internal;
using System;
+using ProgressMonitor = MonoDevelop.Core.ProgressMonitor;
namespace MonoDevelop.VersionControl.Git
{
@@ -287,7 +288,7 @@ namespace MonoDevelop.VersionControl.Git
return repo;
}
- public static MergeCommandResult MergeTrees (ProgressMonitor monitor, NGit.Repository repo, RevCommit srcBase, RevCommit srcCommit, string sourceDisplayName, bool commitResult)
+ public static MergeCommandResult MergeTrees (NGit.ProgressMonitor monitor, NGit.Repository repo, RevCommit srcBase, RevCommit srcCommit, string sourceDisplayName, bool commitResult)
{
RevCommit newHead;
RevWalk revWalk = new RevWalk(repo);
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Stash.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Stash.cs
index ccf2f2e338..be5d4fd6d1 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Stash.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Stash.cs
@@ -300,7 +300,7 @@ namespace MonoDevelop.VersionControl.Git
}
}
- internal MergeCommandResult Apply (ProgressMonitor monitor, Stash stash)
+ internal MergeCommandResult Apply (NGit.ProgressMonitor monitor, Stash stash)
{
monitor.Start (1);
monitor.BeginTask ("Applying stash", 100);
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/StashManagerDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/StashManagerDialog.cs
index b546e803fc..284522c521 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/StashManagerDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/StashManagerDialog.cs
@@ -93,13 +93,11 @@ namespace MonoDevelop.VersionControl.Git
return (Stash) store.GetValue (it, 0);
}
- void ApplyStashAndRemove(Stash s)
+ async void ApplyStashAndRemove (Stash s)
{
using (IdeApp.Workspace.GetFileStatusTracker ()) {
- GitService.ApplyStash (s).Completed += delegate(IAsyncOperation op) {
- if (op.Success)
- stashes.Remove (s);
- };
+ await GitService.ApplyStash (s);
+ stashes.Remove (s);
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/LibSvnClient.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/LibSvnClient.cs
index fe6ecd5e69..c331c3b3da 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/LibSvnClient.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/LibSvnClient.cs
@@ -146,7 +146,6 @@ namespace MonoDevelop.VersionControl.Subversion.Unix {
public abstract IntPtr client_get_wc_root (out IntPtr wcroot_abspath, string local_abspath, IntPtr ctx, IntPtr result_pool, IntPtr scratch_pool);
- // TODO: Check if intptr
public abstract IntPtr strerror (int statcode, byte[] buf, int bufsize);
public abstract IntPtr path_internal_style (string path, IntPtr pool);
@@ -617,8 +616,56 @@ namespace MonoDevelop.VersionControl.Subversion.Unix {
Locked,
Unlocked,
FailedLock,
- FailedUnlock
- // TODO: Add more enum data
+ FailedUnlock,
+ Exists,
+ ChangelistSet,
+ ChangelistClear,
+ ChangelistMoved,
+ MergeBegin,
+ ForeignMergeBegin,
+ UpdateReplace,
+ PropertyAdded,
+ PropertyDeleted,
+ PropertyDeletedNonexistent,
+ RevpropSet,
+ RevpropDeleted,
+ MergeCompleted,
+ TreeConflict,
+ FailedExternal,
+ UpdateStarted,
+ UpdateSkipObstruction,
+ UpdateSkipWorkingOnly,
+ UpdateSkipAccessDenied,
+ UpdateExternalRemoved,
+ UpdateShadowedAdd,
+ UpdateShadowedDelete,
+ MergeRecordInfo,
+ UpgradedPath,
+ MergeRecordInfoBegin,
+ MergeElideInfo,
+ Patch,
+ PatchAppliedHunk,
+ PatchRejectedHunk,
+ PatchHunkAlreadyApplied,
+ CommitCopied,
+ CommitCopiedReplaced,
+ UrlRedirect,
+ PathNonexistent,
+ Exclude,
+ FailedConflict,
+ FailedMissing,
+ FailedOutOfDate,
+ FailedNoParent,
+ FailedLocked,
+ FailedForbiddenByServer,
+ SkipConflicted,
+ UpdateBrokenLock,
+ FailedObstruction,
+ ConflictResolverStarting,
+ ConflictResolverDone,
+ LeftLocalModifications,
+ ForeignCopyBegin,
+ MoveBroken,
}
public enum NotifyState {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs
index b94c055d25..a27a322a82 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs
@@ -11,6 +11,8 @@ using svn_revnum_t = System.IntPtr;
using size_t = System.Int32;
using off_t = System.Int64;
using MonoDevelop.Projects.Text;
+using System.Threading;
+using System.Linq;
namespace MonoDevelop.VersionControl.Subversion.Unix
{
@@ -77,6 +79,7 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
return error.message;
else {
byte[] buf = new byte [300];
+ // Caller will handle the lock.
Svn.strerror (error.apr_err, buf, buf.Length);
return Encoding.UTF8.GetString (buf);
}
@@ -86,16 +89,25 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
{
IntPtr p;
+ // Caller will handle the lock.
Apr.pool_create_ex (out p, parent, IntPtr.Zero, IntPtr.Zero);
if (p == IntPtr.Zero)
throw new InvalidOperationException ("Could not create an APR pool.");
return p;
}
+
+ internal static void destroypool (IntPtr pool)
+ {
+ // Caller will handle lock.
+ if (pool != IntPtr.Zero)
+ Apr.pool_destroy (pool);
+ }
public static string NormalizePath (string pathOrUrl, IntPtr localpool)
{
if (pathOrUrl == null)
return null;
+ // Caller will handle the lock.
IntPtr res = Svn.path_internal_style (pathOrUrl, localpool);
return Marshal.PtrToStringAnsi (res);
}
@@ -129,7 +141,9 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
public static string GetVersion ()
{
- IntPtr ptr = Svn.client_version ();
+ IntPtr ptr;
+ lock (Svn)
+ ptr = Svn.client_version ();
LibSvnClient.svn_version_t ver = (LibSvnClient.svn_version_t)Marshal.PtrToStructure (ptr, typeof(LibSvnClient.svn_version_t));
return ver.major + "." + ver.minor + "." + ver.patch;
}
@@ -173,26 +187,6 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
return new UnixSvnBackend ();
}
- public override string GetPathUrl (FilePath path)
- {
- if (path == FilePath.Null)
- throw new ArgumentNullException();
-
- IntPtr ret = IntPtr.Zero;
- IntPtr localpool = newpool (IntPtr.Zero);
- try {
- string npath = NormalizePath (path, localpool);
- CheckError (Svn.client_url_from_path (ref ret, npath, localpool));
- } finally {
- Apr.pool_destroy (localpool);
- }
-
- if (ret == IntPtr.Zero)
- return null;
-
- return Marshal.PtrToStringAnsi (ret);
- }
-
public override string GetDirectoryDotSvn (FilePath path)
{
if (Pre_1_7)
@@ -240,15 +234,17 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
return SvnClient.newpool (parent);
}
+ static void destroypool (IntPtr pool)
+ {
+ SvnClient.destroypool (pool);
+ }
+
bool disposed;
readonly IntPtr auth_baton;
readonly IntPtr pool;
readonly IntPtr ctx;
- readonly object sync = new object();
- bool inProgress;
-
- IProgressMonitor updatemonitor;
+ ProgressMonitor updatemonitor;
ArrayList updateFileList;
string commitmessage;
@@ -274,109 +270,113 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
public UnixSvnBackend ()
{
- // Allocate the APR pool and the SVN client context.
- pool = newpool (IntPtr.Zero);
+ lock (svn) {
+ // Allocate the APR pool and the SVN client context.
+ pool = newpool (IntPtr.Zero);
- // Make sure the config directory is properly created.
- // If the config directory and specifically the subdirectories
- // for the authentication providers don't exist, authentication
- // data won't be saved and no error is given.
- svn.config_ensure (null, pool);
+ // Make sure the config directory is properly created.
+ // If the config directory and specifically the subdirectories
+ // for the authentication providers don't exist, authentication
+ // data won't be saved and no error is given.
+ svn.config_ensure (null, pool);
- // Load user and system configuration
- svn.config_get_config (ref config_hash, null, pool);
+ // Load user and system configuration
+ svn.config_get_config (ref config_hash, null, pool);
- if (svn.client_create_context (out ctx, pool) != IntPtr.Zero)
- throw new InvalidOperationException ("Could not create a Subversion client context.");
+ if (svn.client_create_context (out ctx, pool) != IntPtr.Zero)
+ throw new InvalidOperationException ("Could not create a Subversion client context.");
- // Set the callbacks on the client context structure.
- notify_func = new LibSvnClient.svn_wc_notify_func2_t (svn_wc_notify_func_t_impl);
- Marshal.WriteIntPtr (ctx,
- (int) Marshal.OffsetOf (typeof (LibSvnClient.svn_client_ctx_t), "NotifyFunc2"),
- Marshal.GetFunctionPointerForDelegate (notify_func));
- log_func = new LibSvnClient.svn_client_get_commit_log_t (svn_client_get_commit_log_impl);
- Marshal.WriteIntPtr (ctx,
- (int) Marshal.OffsetOf (typeof (LibSvnClient.svn_client_ctx_t), "LogMsgFunc"),
- Marshal.GetFunctionPointerForDelegate (log_func));
- progress_func = new LibSvnClient.svn_ra_progress_notify_func_t (svn_ra_progress_notify_func_t_impl);
- Marshal.WriteIntPtr (ctx,
- (int) Marshal.OffsetOf (typeof (LibSvnClient.svn_client_ctx_t), "progress_func"),
- Marshal.GetFunctionPointerForDelegate (progress_func));
- cancel_func = new LibSvnClient.svn_cancel_func_t (svn_cancel_func_t_impl);
- Marshal.WriteIntPtr (ctx,
- (int) Marshal.OffsetOf (typeof (LibSvnClient.svn_client_ctx_t), "cancel_func"),
- Marshal.GetFunctionPointerForDelegate (cancel_func));
-
- Marshal.WriteIntPtr (ctx,
- (int) Marshal.OffsetOf (typeof (LibSvnClient.svn_client_ctx_t), "config"),
- config_hash);
-
- if (!SvnClient.Pre_1_7) {
- IntPtr scratch = newpool (IntPtr.Zero);
- svn.wc_context_create (out wc_ctx, IntPtr.Zero, pool, scratch);
+ // Set the callbacks on the client context structure.
+ notify_func = new LibSvnClient.svn_wc_notify_func2_t (svn_wc_notify_func_t_impl);
Marshal.WriteIntPtr (ctx,
- (int) Marshal.OffsetOf (typeof (LibSvnClient.svn_client_ctx_t), "wc_ctx"),
- wc_ctx);
- apr.pool_destroy (scratch);
- }
+ (int)Marshal.OffsetOf (typeof(LibSvnClient.svn_client_ctx_t), "NotifyFunc2"),
+ Marshal.GetFunctionPointerForDelegate (notify_func));
+ log_func = new LibSvnClient.svn_client_get_commit_log_t (svn_client_get_commit_log_impl);
+ Marshal.WriteIntPtr (ctx,
+ (int)Marshal.OffsetOf (typeof(LibSvnClient.svn_client_ctx_t), "LogMsgFunc"),
+ Marshal.GetFunctionPointerForDelegate (log_func));
+ progress_func = new LibSvnClient.svn_ra_progress_notify_func_t (svn_ra_progress_notify_func_t_impl);
+ Marshal.WriteIntPtr (ctx,
+ (int)Marshal.OffsetOf (typeof(LibSvnClient.svn_client_ctx_t), "progress_func"),
+ Marshal.GetFunctionPointerForDelegate (progress_func));
+ cancel_func = new LibSvnClient.svn_cancel_func_t (svn_cancel_func_t_impl);
+ Marshal.WriteIntPtr (ctx,
+ (int)Marshal.OffsetOf (typeof(LibSvnClient.svn_client_ctx_t), "cancel_func"),
+ Marshal.GetFunctionPointerForDelegate (cancel_func));
- IntPtr providers = apr.array_make (pool, 16, IntPtr.Size);
- IntPtr item;
+ Marshal.WriteIntPtr (ctx,
+ (int)Marshal.OffsetOf (typeof(LibSvnClient.svn_client_ctx_t), "config"),
+ config_hash);
+
+ if (!SvnClient.Pre_1_7) {
+ IntPtr scratch = newpool (IntPtr.Zero);
+ svn.wc_context_create (out wc_ctx, IntPtr.Zero, pool, scratch);
+ Marshal.WriteIntPtr (ctx,
+ (int)Marshal.OffsetOf (typeof(LibSvnClient.svn_client_ctx_t), "wc_ctx"),
+ wc_ctx);
+ apr.pool_destroy (scratch);
+ }
+
+ IntPtr providers = apr.array_make (pool, 16, IntPtr.Size);
+ IntPtr item;
- // The main disk-caching auth providers, for both
- // 'username/password' creds and 'username' creds.
+ // The main disk-caching auth providers, for both
+ // 'username/password' creds and 'username' creds.
- item = apr.array_push (providers);
- svn.client_get_simple_provider (item, pool);
+ item = apr.array_push (providers);
+ svn.client_get_simple_provider (item, pool);
- item = apr.array_push (providers);
- svn.client_get_username_provider (item, pool);
+ item = apr.array_push (providers);
+ svn.client_get_username_provider (item, pool);
- // The server-cert, client-cert, and client-cert-password providers
+ // The server-cert, client-cert, and client-cert-password providers
- item = apr.array_push (providers);
- svn.client_get_ssl_server_trust_file_provider (item, pool);
+ item = apr.array_push (providers);
+ svn.client_get_ssl_server_trust_file_provider (item, pool);
- item = apr.array_push (providers);
- svn.client_get_ssl_client_cert_file_provider (item, pool);
+ item = apr.array_push (providers);
+ svn.client_get_ssl_client_cert_file_provider (item, pool);
- item = apr.array_push (providers);
- svn.client_get_ssl_client_cert_pw_file_provider (item, pool);
+ item = apr.array_push (providers);
+ svn.client_get_ssl_client_cert_pw_file_provider (item, pool);
- // Two basic prompt providers: username/password, and just username.
+ // Two basic prompt providers: username/password, and just username.
- item = apr.array_push (providers);
- svn.client_get_simple_prompt_provider (item, OnAuthSimplePromptCallback, IntPtr.Zero, 2, pool);
+ item = apr.array_push (providers);
+ svn.client_get_simple_prompt_provider (item, OnAuthSimplePromptCallback, IntPtr.Zero, 2, pool);
- item = apr.array_push (providers);
- svn.client_get_username_prompt_provider (item, OnAuthUsernamePromptCallback, IntPtr.Zero, 2, pool);
+ item = apr.array_push (providers);
+ svn.client_get_username_prompt_provider (item, OnAuthUsernamePromptCallback, IntPtr.Zero, 2, pool);
- // Three ssl prompt providers, for server-certs, client-certs,
- // and client-cert-passphrases.
+ // Three ssl prompt providers, for server-certs, client-certs,
+ // and client-cert-passphrases.
- item = apr.array_push (providers);
- svn.client_get_ssl_server_trust_prompt_provider (item, OnAuthSslServerTrustPromptCallback, IntPtr.Zero, pool);
+ item = apr.array_push (providers);
+ svn.client_get_ssl_server_trust_prompt_provider (item, OnAuthSslServerTrustPromptCallback, IntPtr.Zero, pool);
- item = apr.array_push (providers);
- svn.client_get_ssl_client_cert_prompt_provider (item, OnAuthSslClientCertPromptCallback, IntPtr.Zero, 2, pool);
+ item = apr.array_push (providers);
+ svn.client_get_ssl_client_cert_prompt_provider (item, OnAuthSslClientCertPromptCallback, IntPtr.Zero, 2, pool);
- item = apr.array_push (providers);
- svn.client_get_ssl_client_cert_pw_prompt_provider (item, OnAuthSslClientCertPwPromptCallback, IntPtr.Zero, 2, pool);
+ item = apr.array_push (providers);
+ svn.client_get_ssl_client_cert_pw_prompt_provider (item, OnAuthSslClientCertPwPromptCallback, IntPtr.Zero, 2, pool);
- // Create the authentication baton
- svn.auth_open (out auth_baton, providers, pool);
+ // Create the authentication baton
+ svn.auth_open (out auth_baton, providers, pool);
- Marshal.WriteIntPtr (ctx,
- (int) Marshal.OffsetOf (typeof(LibSvnClient.svn_client_ctx_t), "auth_baton"),
- auth_baton);
+ Marshal.WriteIntPtr (ctx,
+ (int)Marshal.OffsetOf (typeof(LibSvnClient.svn_client_ctx_t), "auth_baton"),
+ auth_baton);
+ }
}
public void Dispose ()
{
- if (!disposed) {
- if (apr != null)
- apr.pool_destroy(pool);
- disposed = true;
+ lock (svn) {
+ if (!disposed) {
+ if (apr != null)
+ apr.pool_destroy (pool);
+ disposed = true;
+ }
}
}
@@ -387,14 +387,15 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
static IntPtr GetCancelError ()
{
- LibSvnClient.svn_error_t error = new LibSvnClient.svn_error_t ();
- error.apr_err = LibApr.APR_OS_START_USEERR;
- error.message = "Operation cancelled.";
-
// Subversion destroys the error pool to dispose the error object,
// so we need to use a non-shared pool.
IntPtr localpool = newpool (IntPtr.Zero);
- error.pool = localpool;
+ var error = new LibSvnClient.svn_error_t {
+ apr_err = LibApr.APR_OS_START_USEERR,
+ message = "Operation cancelled.",
+ pool = localpool,
+ };
+
return apr.pcalloc (localpool, error);
}
@@ -420,8 +421,9 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
static readonly LibSvnClient.svn_auth_username_prompt_func_t OnAuthUsernamePromptCallback = OnAuthUsernamePrompt;
static IntPtr OnAuthUsernamePrompt (ref IntPtr cred, IntPtr baton, string realm, bool may_save, IntPtr pool)
{
- LibSvnClient.svn_auth_cred_username_t data = new LibSvnClient.svn_auth_cred_username_t ();
- data.username = "";
+ LibSvnClient.svn_auth_cred_username_t data = new LibSvnClient.svn_auth_cred_username_t {
+ username = "",
+ };
bool ms;
if (UserNameAuthenticationPrompt (realm, may_save, ref data.username, out ms)) {
data.may_save = ms;
@@ -438,15 +440,16 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
static readonly LibSvnClient.svn_auth_ssl_server_trust_prompt_func_t OnAuthSslServerTrustPromptCallback = OnAuthSslServerTrustPrompt;
static IntPtr OnAuthSslServerTrustPrompt (ref IntPtr cred, IntPtr baton, string realm, UInt32 failures, ref LibSvnClient.svn_auth_ssl_server_cert_info_t cert_info, bool may_save, IntPtr pool)
{
- LibSvnClient.svn_auth_cred_ssl_server_trust_t data = new LibSvnClient.svn_auth_cred_ssl_server_trust_t ();
-
- CertficateInfo ci = new CertficateInfo ();
- ci.AsciiCert = cert_info.ascii_cert;
- ci.Fingerprint = cert_info.fingerprint;
- ci.HostName = cert_info.hostname;
- ci.IssuerName = cert_info.issuer_dname;
- ci.ValidFrom = cert_info.valid_from;
- ci.ValidUntil = cert_info.valid_until;
+ var data = new LibSvnClient.svn_auth_cred_ssl_server_trust_t ();
+
+ var ci = new CertficateInfo {
+ AsciiCert = cert_info.ascii_cert,
+ Fingerprint = cert_info.fingerprint,
+ HostName = cert_info.hostname,
+ IssuerName = cert_info.issuer_dname,
+ ValidFrom = cert_info.valid_from,
+ ValidUntil = cert_info.valid_until,
+ };
SslFailure accepted_failures;
bool ms;
@@ -466,7 +469,7 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
static readonly LibSvnClient.svn_auth_ssl_client_cert_prompt_func_t OnAuthSslClientCertPromptCallback = OnAuthSslClientCertPrompt;
static IntPtr OnAuthSslClientCertPrompt (ref IntPtr cred, IntPtr baton, string realm, bool may_save, IntPtr pool)
{
- LibSvnClient.svn_auth_cred_ssl_client_cert_t data = new LibSvnClient.svn_auth_cred_ssl_client_cert_t ();
+ var data = new LibSvnClient.svn_auth_cred_ssl_client_cert_t ();
bool ms;
if (SslClientCertAuthenticationPrompt (realm, may_save, out data.cert_file, out ms)) {
data.may_save = ms;
@@ -483,7 +486,7 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
static readonly LibSvnClient.svn_auth_ssl_client_cert_pw_prompt_func_t OnAuthSslClientCertPwPromptCallback = OnAuthSslClientCertPwPrompt;
static IntPtr OnAuthSslClientCertPwPrompt (ref IntPtr cred, IntPtr baton, string realm, bool may_save, IntPtr pool)
{
- LibSvnClient.svn_auth_cred_ssl_client_cert_pw_t data;
+ var data = new LibSvnClient.svn_auth_cred_ssl_client_cert_pw_t ();
bool ms;
if (SslClientCertPwAuthenticationPrompt (realm, may_save, out data.password, out ms)) {
data.may_save = ms;
@@ -513,6 +516,17 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
{
return SvnClient.NormalizePath (pathOrUrl, localpool);
}
+
+ static IntPtr NormalizePaths (IntPtr pool, params FilePath[] paths)
+ {
+ IntPtr array = apr.array_make (pool, 0, IntPtr.Size);
+ foreach (string path in paths) {
+ string pathorurl = NormalizePath (path, pool);
+ IntPtr item = apr.array_push (array);
+ Marshal.WriteIntPtr (item, apr.pstrdup (pool, pathorurl));
+ }
+ return array;
+ }
public override IEnumerable<DirectoryEntry> ListUrl (string url, bool recurse, SvnRevision rev)
{
@@ -520,12 +534,13 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
throw new ArgumentNullException ();
LibSvnClient.Rev revision = (LibSvnClient.Rev) rev;
- IntPtr localpool = TryStartOperation (null);
+ IntPtr localpool = IntPtr.Zero;
List<DirectoryEntry> items = new List<DirectoryEntry> ();
try {
IntPtr hash;
-
+
+ localpool = TryStartOperation (null);
url = NormalizePath (url, localpool);
CheckError (svn.client_ls (out hash, url, ref revision,
@@ -538,22 +553,22 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
apr.hash_this (item, out nameptr, out namelen, out val);
string name = Marshal.PtrToStringAnsi (nameptr);
- LibSvnClient.svn_dirent_t ent = (LibSvnClient.svn_dirent_t) Marshal.PtrToStructure (val, typeof (LibSvnClient.svn_dirent_t));
+ var ent = (LibSvnClient.svn_dirent_t) Marshal.PtrToStructure (val, typeof (LibSvnClient.svn_dirent_t));
item = apr.hash_next (item);
- DirectoryEntry dent = new DirectoryEntry ();
- dent.Name = name;
- dent.IsDirectory = ent.kind == LibSvnClient.svn_node_kind_t.Dir;
- dent.Size = ent.size;
- dent.HasProps = ent.has_props;
- dent.CreatedRevision = (int) ent.created_rev;
- dent.Time = new DateTime (1970, 1, 1).AddTicks(ent.time * 10);
- dent.LastAuthor = ent.last_author;
+ var dent = new DirectoryEntry {
+ Name = name,
+ IsDirectory = ent.kind == LibSvnClient.svn_node_kind_t.Dir,
+ Size = ent.size,
+ HasProps = ent.has_props,
+ CreatedRevision = (int) ent.created_rev,
+ Time = new DateTime (1970, 1, 1).AddTicks(ent.time * 10),
+ LastAuthor = ent.last_author,
+ };
items.Add (dent);
}
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
return items;
@@ -568,8 +583,9 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
ArrayList ret = new ArrayList ();
StatusCollector collector = new StatusCollector (ret);
- var localpool = TryStartOperation (null);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (null);
string pathorurl = NormalizePath (path, localpool);
CheckError (svn.client_status (IntPtr.Zero, pathorurl, ref revision,
collector.Func,
@@ -584,8 +600,7 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
if (e.ErrorCode != 155007 && e.ErrorCode != 155008)
throw;
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
List<VersionInfo> nodes = new List<VersionInfo>();
@@ -605,8 +620,9 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
List<SvnRevision> ret = new List<SvnRevision> ();
IntPtr strptr = IntPtr.Zero;
- var localpool = TryStartOperation (null);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (null);
IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
IntPtr first = apr.array_push (array);
string pathorurl = NormalizePath (path, localpool);
@@ -621,8 +637,7 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
} finally {
if (strptr != IntPtr.Zero)
Marshal.FreeHGlobal (strptr);
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
return ret;
@@ -649,13 +664,13 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
Annotation[] annotations = new Annotation [numAnnotations];
AnnotationCollector collector = new AnnotationCollector (annotations);
- var localpool = TryStartOperation (null);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (null);
string path = NormalizePath (file.FullPath, localpool);
CheckError (svn.client_blame (path, ref revisionStart, ref revisionEnd, collector.Func, IntPtr.Zero, ctx, localpool));
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
return annotations;
@@ -695,8 +710,9 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
LibSvnClient.Rev revision = (LibSvnClient.Rev) rev;
- var localpool = TryStartOperation (null);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (null);
pathorurl = NormalizePath (pathorurl, localpool);
StreamCollector collector = new StreamCollector (stream);
IntPtr svnstream = svn.stream_create (IntPtr.Zero, localpool);
@@ -705,12 +721,11 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
// Otherwise, it will use Head as peg and it will throw exceptions.
CheckError (svn.client_cat2 (svnstream, pathorurl, ref revision, ref revision, ctx, localpool), 195007);
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
- public override void Update (FilePath path, bool recurse, IProgressMonitor monitor)
+ public override void Update (FilePath path, bool recurse, ProgressMonitor monitor)
{
if (path == FilePath.Null || monitor == null)
throw new ArgumentNullException();
@@ -718,15 +733,15 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
updateFileList = new ArrayList ();
LibSvnClient.Rev rev = LibSvnClient.Rev.Head;
- var localpool = TryStartOperation (monitor);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (monitor);
string pathorurl = NormalizePath (path, localpool);
IntPtr result = Marshal.AllocHGlobal (IntPtr.Size);
CheckError (svn.client_update (result, pathorurl, ref rev, recurse, ctx, localpool));
Marshal.FreeHGlobal (result);
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
foreach (string file in updateFileList)
FileService.NotifyFileChanged (file, true);
@@ -735,56 +750,50 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
}
}
- public override void Revert (FilePath[] paths, bool recurse, IProgressMonitor monitor)
+ public override void Revert (FilePath[] paths, bool recurse, ProgressMonitor monitor)
{
if (paths == null || monitor == null)
throw new ArgumentNullException();
- var localpool = TryStartOperation (monitor);
+ IntPtr localpool = IntPtr.Zero;
try {
- // Put each item into an APR array.
- IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
- foreach (string path in paths) {
- string pathorurl = NormalizePath (path, localpool);
- IntPtr item = apr.array_push (array);
- Marshal.WriteIntPtr (item, apr.pstrdup (localpool, pathorurl));
- }
-
+ localpool = TryStartOperation (monitor);
+ IntPtr array = NormalizePaths (localpool, paths);
CheckError (svn.client_revert (array, recurse, ctx, localpool));
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
- public override void Add (FilePath path, bool recurse, IProgressMonitor monitor)
+ public override void Add (FilePath path, bool recurse, ProgressMonitor monitor)
{
if (path == FilePath.Null || monitor == null)
throw new ArgumentNullException ();
nb = new notify_baton ();
- var localpool = TryStartOperation (monitor);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (monitor);
string pathorurl = NormalizePath (path, localpool);
CheckError (svn.client_add3 (pathorurl, recurse, true, false, ctx, localpool));
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
- public override void Checkout (string url, FilePath path, Revision revision, bool recurse, IProgressMonitor monitor)
+ public override void Checkout (string url, FilePath path, Revision revision, bool recurse, ProgressMonitor monitor)
{
if (url == null || monitor == null)
throw new ArgumentNullException ();
if (revision == null)
revision = SvnRevision.Head;
- LibSvnClient.Rev rev = (LibSvnClient.Rev) revision;
+ var rev = (LibSvnClient.Rev) revision;
nb = new notify_baton ();
- var localpool = TryStartOperation (monitor);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (monitor);
// Using Uri here because the normalization method doesn't remove the redundant port number when using https
url = NormalizePath (new Uri(url).ToString(), localpool);
string npath = NormalizePath (path, localpool);
@@ -796,27 +805,20 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
if (Directory.Exists (path.ParentDirectory))
FileService.DeleteDirectory (path.ParentDirectory);
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
- public override void Commit (FilePath[] paths, string message, IProgressMonitor monitor)
+ public override void Commit (FilePath[] paths, string message, ProgressMonitor monitor)
{
if (paths == null || message == null || monitor == null)
throw new ArgumentNullException();
nb = new notify_baton ();
- var localpool = TryStartOperation (monitor);
+ IntPtr localpool = IntPtr.Zero;
try {
- // Put each item into an APR array.
- IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
- foreach (string path in paths) {
- string npath = NormalizePath (path, localpool);
- IntPtr item = apr.array_push (array);
- Marshal.WriteIntPtr (item, apr.pstrdup (localpool, npath));
- }
-
+ localpool = TryStartOperation (monitor);
+ IntPtr array = NormalizePaths (localpool, paths);
IntPtr commit_info = IntPtr.Zero;
commitmessage = message;
@@ -829,26 +831,20 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
}
} finally {
commitmessage = null;
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
- public override void Mkdir (string[] paths, string message, IProgressMonitor monitor)
+ public override void Mkdir (string[] paths, string message, ProgressMonitor monitor)
{
if (paths == null || monitor == null)
throw new ArgumentNullException ();
nb = new notify_baton ();
- var localpool = TryStartOperation (monitor);
+ IntPtr localpool = IntPtr.Zero;
try {
- // Put each item into an APR array.
- IntPtr array = apr.array_make (localpool, paths.Length, IntPtr.Size);
- foreach (string path in paths) {
- string npath = NormalizePath (path, localpool);
- IntPtr item = apr.array_push (array);
- Marshal.WriteIntPtr (item, apr.pstrdup (localpool, npath));
- }
+ localpool = TryStartOperation (monitor);
+ IntPtr array = NormalizePaths (localpool, paths.Select (p => (FilePath)p).ToArray ());
commitmessage = message;
@@ -856,36 +852,29 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
CheckError (svn.client_mkdir2 (ref commit_info, array, ctx, localpool));
} finally {
commitmessage = null;
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
- public override void Delete (FilePath path, bool force, IProgressMonitor monitor)
+ public override void Delete (FilePath path, bool force, ProgressMonitor monitor)
{
if (path == FilePath.Null || monitor == null)
throw new ArgumentNullException ();
nb = new notify_baton ();
- var localpool = TryStartOperation (monitor);
+ IntPtr localpool = IntPtr.Zero;
try {
- // Put each item into an APR array.
- IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
- //foreach (string path in paths) {
- string npath = NormalizePath (path, localpool);
- IntPtr item = apr.array_push (array);
- Marshal.WriteIntPtr (item, apr.pstrdup (localpool, npath));
- //}
+ localpool = TryStartOperation (monitor);
+ IntPtr array = NormalizePaths (localpool, path);
IntPtr commit_info = IntPtr.Zero;
CheckError (svn.client_delete (ref commit_info, array, force, ctx, localpool));
} finally {
commitmessage = null;
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
- public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, IProgressMonitor monitor)
+ public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, ProgressMonitor monitor)
{
if (srcPath == FilePath.Null || destPath == FilePath.Null || monitor == null)
throw new ArgumentNullException ();
@@ -894,29 +883,25 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
nb = new notify_baton ();
IntPtr commit_info = IntPtr.Zero;
- var localpool = TryStartOperation (monitor);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (monitor);
string nsrcPath = NormalizePath (srcPath, localpool);
string ndestPath = NormalizePath (destPath, localpool);
CheckError (svn.client_move (ref commit_info, nsrcPath, ref revision,
ndestPath, force, ctx, localpool));
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
- public override void Lock (IProgressMonitor monitor, string comment, bool stealLock, params FilePath[] paths)
+ public override void Lock (ProgressMonitor monitor, string comment, bool stealLock, params FilePath[] paths)
{
nb = new notify_baton ();
- var localpool = TryStartOperation (monitor);
+ IntPtr localpool = IntPtr.Zero;
try {
- IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
- foreach (string path in paths) {
- string npath = NormalizePath (path, localpool);
- IntPtr item = apr.array_push (array);
- Marshal.WriteIntPtr (item, apr.pstrdup (localpool, npath));
- }
+ localpool = TryStartOperation (monitor);
+ IntPtr array = NormalizePaths (localpool, paths);
lockFileList = new ArrayList ();
requiredLockState = LibSvnClient.NotifyLockState.Locked;
@@ -924,23 +909,18 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
if (paths.Length != lockFileList.Count)
throw new SubversionException ("Lock operation failed.");
} finally {
- apr.pool_destroy (localpool);
lockFileList = null;
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
- public override void Unlock (IProgressMonitor monitor, bool breakLock, params FilePath[] paths)
+ public override void Unlock (ProgressMonitor monitor, bool breakLock, params FilePath[] paths)
{
nb = new notify_baton ();
- var localpool = TryStartOperation (monitor);
+ IntPtr localpool = IntPtr.Zero;
try {
- IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
- foreach (string path in paths) {
- string npath = NormalizePath (path, localpool);
- IntPtr item = apr.array_push (array);
- Marshal.WriteIntPtr (item, apr.pstrdup (localpool, npath));
- }
+ localpool = TryStartOperation (monitor);
+ IntPtr array = NormalizePaths (localpool, paths);
lockFileList = new ArrayList ();
requiredLockState = LibSvnClient.NotifyLockState.Unlocked;
@@ -948,9 +928,8 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
if (paths.Length != lockFileList.Count)
throw new SubversionException ("Lock operation failed.");
} finally {
- apr.pool_destroy (localpool);
lockFileList = null;
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
@@ -964,8 +943,9 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
LibSvnClient.Rev revision1 = (LibSvnClient.Rev) rev1;
LibSvnClient.Rev revision2 = (LibSvnClient.Rev) rev2;
- var localpool = TryStartOperation (null);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (null);
IntPtr options = apr.array_make (localpool, 0, IntPtr.Size);
fout = Path.GetTempFileName ();
@@ -1001,18 +981,17 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
FileService.DeleteFile (fout);
} catch {
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
}
- public override void RevertToRevision (FilePath path, Revision revision, IProgressMonitor monitor)
+ public override void RevertToRevision (FilePath path, Revision revision, ProgressMonitor monitor)
{
Merge (path, LibSvnClient.Rev.Head, (LibSvnClient.Rev) revision);
}
- public override void RevertRevision (FilePath path, Revision revision, IProgressMonitor monitor)
+ public override void RevertRevision (FilePath path, Revision revision, ProgressMonitor monitor)
{
SvnRevision srev = (SvnRevision) revision;
Merge (path, (LibSvnClient.Rev) srev, LibSvnClient.Rev.Number (srev.Rev - 1));
@@ -1020,8 +999,9 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
private void Merge (string path, LibSvnClient.Rev revision1, LibSvnClient.Rev revision2)
{
- var localpool = TryStartOperation (null);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (null);
path = NormalizePath (path, localpool);
LibSvnClient.Rev working = LibSvnClient.Rev.Working;
CheckError (svn.client_merge_peg2 (path,
@@ -1034,117 +1014,110 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
ctx, localpool));
}
finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
- public override void Ignore (FilePath[] paths)
+ static void GetProps (StringBuilder props, IntPtr pool, IntPtr result)
{
- IntPtr hash_item, hash_name, hash_val;
+ LibSvnClient.svn_string_t new_props;
+ IntPtr hash_name, hash_val;
+ IntPtr hash_item = apr.hash_first (pool, result);
int length;
+
+ while (hash_item != IntPtr.Zero) {
+ apr.hash_this (hash_item, out hash_name, out length, out hash_val);
+ new_props = (LibSvnClient.svn_string_t) Marshal.PtrToStructure (hash_val, typeof (LibSvnClient.svn_string_t));
+ props.Append (Marshal.PtrToStringAnsi (new_props.data));
+ hash_item = apr.hash_next (hash_item);
+ }
+ }
+
+ public override void Ignore (FilePath[] paths)
+ {
IntPtr result;
- IntPtr props_ptr = IntPtr.Zero;
- StringBuilder props = new StringBuilder ();
+ IntPtr props_ptr;
+ var props = new StringBuilder ();
string new_path;
LibSvnClient.svn_string_t new_props;
LibSvnClient.Rev rev = LibSvnClient.Rev.Working;
- var localpool = TryStartOperation (null);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (null);
foreach (var path in paths) {
new_path = NormalizePath (path, localpool);
CheckError (svn.client_propget (out result, "svn:ignore", Path.GetDirectoryName (new_path),
ref rev, false, ctx, localpool));
- hash_item = apr.hash_first (localpool, result);
- while (hash_item != IntPtr.Zero) {
- apr.hash_this (hash_item, out hash_name, out length, out hash_val);
- new_props = (LibSvnClient.svn_string_t) Marshal.PtrToStructure (hash_val, typeof (LibSvnClient.svn_string_t));
- props.Append (Marshal.PtrToStringAnsi (new_props.data));
- hash_item = apr.hash_next (hash_item);
- }
+ GetProps (props, localpool, result);
+
props.AppendLine (Path.GetFileName (new_path));
- new_props = new LibSvnClient.svn_string_t ();
- new_props.data = Marshal.StringToHGlobalAnsi (props.ToString ());
- new_props.len = props.Length;
+ new_props = new LibSvnClient.svn_string_t {
+ data = Marshal.StringToHGlobalAnsi (props.ToString ()),
+ len = props.Length,
+ };
props_ptr = apr.pcalloc (localpool, new_props);
CheckError (svn.client_propset ("svn:ignore", props_ptr, Path.GetDirectoryName (new_path), false, localpool));
}
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
public override void Unignore (FilePath[] paths)
{
- IntPtr hash_item, hash_name, hash_val;
- int length;
IntPtr result;
- IntPtr props_ptr = IntPtr.Zero;
- StringBuilder props = new StringBuilder ();
+ IntPtr props_ptr;
+ var props = new StringBuilder ();
string new_path;
LibSvnClient.svn_string_t new_props;
LibSvnClient.Rev rev = LibSvnClient.Rev.Working;
int index;
string props_str;
- var localpool = TryStartOperation (null);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (null);
foreach (var path in paths) {
new_path = NormalizePath (path, localpool);
CheckError (svn.client_propget (out result, "svn:ignore", Path.GetDirectoryName (new_path),
ref rev, false, ctx, localpool));
- hash_item = apr.hash_first (localpool, result);
- while (hash_item != IntPtr.Zero) {
- apr.hash_this (hash_item, out hash_name, out length, out hash_val);
- new_props = (LibSvnClient.svn_string_t) Marshal.PtrToStructure (hash_val, typeof (LibSvnClient.svn_string_t));
- props.Append (Marshal.PtrToStringAnsi (new_props.data));
- hash_item = apr.hash_next (hash_item);
- }
+ GetProps (props, localpool, result);
+
props_str = props.ToString ();
index = props_str.IndexOf (Path.GetFileName (new_path) + Environment.NewLine, StringComparison.Ordinal);
props_str = (index < 0) ? props_str : props_str.Remove (index, Path.GetFileName(new_path).Length+1);
- new_props = new LibSvnClient.svn_string_t ();
- new_props.data = Marshal.StringToHGlobalAnsi (props_str);
- new_props.len = props_str.Length;
+ new_props = new LibSvnClient.svn_string_t {
+ data = Marshal.StringToHGlobalAnsi (props_str),
+ len = props_str.Length,
+ };
props_ptr = apr.pcalloc (localpool, new_props);
CheckError (svn.client_propset ("svn:ignore", props_ptr, Path.GetDirectoryName (new_path), false, localpool));
}
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
public override bool HasNeedLock (FilePath file)
{
- IntPtr hash_item, hash_name, hash_val;
- int length;
IntPtr result;
- IntPtr props_ptr = IntPtr.Zero;
- StringBuilder props = new StringBuilder ();
+ var props = new StringBuilder ();
string new_path;
- LibSvnClient.svn_string_t new_props;
LibSvnClient.Rev rev = LibSvnClient.Rev.Working;
- var localpool = TryStartOperation (null);
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (null);
new_path = NormalizePath (file, localpool);
CheckError (svn.client_propget (out result, "svn:needs-lock", new_path,
ref rev, false, ctx, localpool));
- hash_item = apr.hash_first (localpool, result);
- while (hash_item != IntPtr.Zero) {
- apr.hash_this (hash_item, out hash_name, out length, out hash_val);
- new_props = (LibSvnClient.svn_string_t) Marshal.PtrToStructure (hash_val, typeof (LibSvnClient.svn_string_t));
- props.Append (Marshal.PtrToStringAnsi (new_props.data));
- hash_item = apr.hash_next (hash_item);
- }
+ GetProps (props, localpool, result);
+
return props.Length != 0;
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
}
@@ -1172,32 +1145,19 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
return IntPtr.Zero;
}
- string oldStacktrace = String.Empty;
- IntPtr TryStartOperation (IProgressMonitor monitor)
+ IntPtr TryStartOperation (ProgressMonitor monitor)
{
- lock (sync) {
- if (inProgress) {
- var se = new SubversionException ("Another Subversion operation is already in progress.");
- se.Data.Add ("OldStacktrace", oldStacktrace);
- se.Data.Add ("CurrentStackTrace", Environment.StackTrace);
- throw se;
- }
- oldStacktrace = Environment.StackTrace;
- inProgress = true;
- updatemonitor = monitor;
- progressData = new ProgressData ();
- return newpool (pool);
- }
+ Monitor.Enter (svn);
+ updatemonitor = monitor;
+ progressData = new ProgressData ();
+ return newpool (pool);
}
- void TryEndOperation ()
+ void TryEndOperation (IntPtr pool)
{
- lock (sync) {
- if (!inProgress)
- throw new SubversionException ("No Subversion operation is in progress.");
- inProgress = false;
- updatemonitor = null;
- }
+ destroypool (pool);
+ updatemonitor = null;
+ Monitor.Exit (svn);
}
static VersionInfo CreateNode (LibSvnClient.StatusEnt ent, Repository repo)
@@ -1266,15 +1226,16 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
IntPtr svn_cancel_func_t_impl (IntPtr baton)
{
- if (updatemonitor == null || !updatemonitor.IsCancelRequested)
+ if (updatemonitor == null || !updatemonitor.CancellationToken.IsCancellationRequested)
return IntPtr.Zero;
- LibSvnClient.svn_error_t err = new LibSvnClient.svn_error_t ();
- err.apr_err = 200015;
- err.message = "The operation was interrupted";
-
IntPtr localpool = newpool (IntPtr.Zero);
- err.pool = localpool;
+ var err = new LibSvnClient.svn_error_t {
+ apr_err = 200015,
+ message = "The operation was interrupted",
+ pool = localpool
+ };
+
return apr.pcalloc (localpool, err);
}
@@ -1525,9 +1486,11 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
return String.Empty;
IntPtr result;
- IntPtr scratch = newpool (pool);
- var localpool = TryStartOperation (null);
+ IntPtr scratch = IntPtr.Zero;
+ IntPtr localpool = IntPtr.Zero;
try {
+ localpool = TryStartOperation (null);
+ scratch = newpool (pool);
string new_path = NormalizePath (path.FullPath, localpool);
SubversionException e = CheckErrorNoThrow (svn.client_get_wc_root (out result, new_path, ctx, localpool, scratch), null);
if (e != null) {
@@ -1553,9 +1516,8 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
}
return Marshal.PtrToStringAnsi (result);
} finally {
- apr.pool_destroy (localpool);
- apr.pool_destroy (scratch);
- TryEndOperation ();
+ destroypool (scratch);
+ TryEndOperation (localpool);
if (TooOld)
WorkingCopyFormatPrompt (false, null);
@@ -1572,15 +1534,15 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
if (!Upgrading || path.IsNullOrEmpty)
return;
- var localpool = TryStartOperation (null);
+ IntPtr localpool = IntPtr.Zero;
bool tryParent = false;
try {
+ localpool = TryStartOperation (null);
CheckError (svn.client_upgrade (path, ctx, localpool));
} catch (Exception e) {
tryParent = true;
} finally {
- apr.pool_destroy (localpool);
- TryEndOperation ();
+ TryEndOperation (localpool);
}
if (tryParent)
@@ -1653,7 +1615,7 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
apr.hash_this (item, out nameptr, out namelen, out val);
string name = Marshal.PtrToStringAnsi (nameptr);
- LibSvnClient.svn_log_changed_path_t ch = (LibSvnClient.svn_log_changed_path_t) Marshal.PtrToStructure (val, typeof (LibSvnClient.svn_log_changed_path_t));
+ LibSvnClient.svn_log_changed_path_t ch = (LibSvnClient.svn_log_changed_path_t) Marshal.PtrToStructure (val, typeof(LibSvnClient.svn_log_changed_path_t));
item = apr.hash_next (item);
RevisionAction ac;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionRepository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionRepository.cs
index 1172cb4bdf..c373e0564a 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionRepository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionRepository.cs
@@ -144,17 +144,17 @@ namespace MonoDevelop.VersionControl.Subversion
return true;
}
- protected override void OnLock (IProgressMonitor monitor, params FilePath[] localPaths)
+ protected override void OnLock (ProgressMonitor monitor, params FilePath[] localPaths)
{
Svn.Lock (monitor, "", false, localPaths);
}
- protected override void OnUnlock (IProgressMonitor monitor, params FilePath[] localPaths)
+ protected override void OnUnlock (ProgressMonitor monitor, params FilePath[] localPaths)
{
Svn.Unlock (monitor, false, localPaths);
}
- protected override Repository OnPublish (string serverPath, FilePath localPath, FilePath[] files, string message, IProgressMonitor monitor)
+ protected override Repository OnPublish (string serverPath, FilePath localPath, FilePath[] files, string message, ProgressMonitor monitor)
{
string url = Url;
if (!serverPath.StartsWith ("/", StringComparison.Ordinal) && !url.EndsWith ("/", StringComparison.Ordinal))
@@ -180,7 +180,7 @@ namespace MonoDevelop.VersionControl.Subversion
return new SubversionRepository (VersionControlSystem, paths[0], localPath);
}
- void PublishDir (Set<FilePath> dirs, FilePath dir, bool rec, IProgressMonitor monitor)
+ void PublishDir (Set<FilePath> dirs, FilePath dir, bool rec, ProgressMonitor monitor)
{
if (dirs.Add (dir.CanonicalPath)) {
if (rec) {
@@ -190,31 +190,28 @@ namespace MonoDevelop.VersionControl.Subversion
}
}
- protected override void OnUpdate (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
+ protected override void OnUpdate (FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
{
foreach (string path in localPaths)
Svn.Update (path, recurse, monitor);
}
- protected override void OnCommit (ChangeSet changeSet, IProgressMonitor monitor)
+ protected override void OnCommit (ChangeSet changeSet, ProgressMonitor monitor)
{
- List<FilePath> list = new List<FilePath> ();
- foreach (ChangeSetItem it in changeSet.Items)
- list.Add (it.LocalPath);
- Svn.Commit (list.ToArray (), changeSet.GlobalComment, monitor);
+ Svn.Commit (changeSet.Items.Select (it => it.LocalPath).ToArray (), changeSet.GlobalComment, monitor);
}
- void CreateDirectory (string[] paths, string message, IProgressMonitor monitor)
+ void CreateDirectory (string[] paths, string message, ProgressMonitor monitor)
{
Svn.Mkdir (paths, message, monitor);
}
- protected override void OnCheckout (FilePath targetLocalPath, Revision rev, bool recurse, IProgressMonitor monitor)
+ protected override void OnCheckout (FilePath targetLocalPath, Revision rev, bool recurse, ProgressMonitor monitor)
{
Svn.Checkout (this.Url, targetLocalPath, rev, recurse, monitor);
}
- protected override void OnRevert (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
+ protected override void OnRevert (FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
{
// If we have an array of paths such as: new [] { "/Foo/Directory", "/Foo/Directory/File1", "/Foo/Directory/File2" }
// svn will successfully revert the first entry (the directory) and then throw an error when trying to revert the
@@ -225,17 +222,17 @@ namespace MonoDevelop.VersionControl.Subversion
Svn.Revert (localPaths, recurse, monitor);
}
- protected override void OnRevertRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
+ protected override void OnRevertRevision (FilePath localPath, Revision revision, ProgressMonitor monitor)
{
Svn.RevertRevision (localPath, revision, monitor);
}
- protected override void OnRevertToRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
+ protected override void OnRevertToRevision (FilePath localPath, Revision revision, ProgressMonitor monitor)
{
Svn.RevertToRevision (localPath, revision, monitor);
}
- protected override void OnAdd (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
+ protected override void OnAdd (FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
{
foreach (FilePath path in localPaths) {
if (IsVersioned (path) && File.Exists (path) && !Directory.Exists (path)) {
@@ -293,10 +290,10 @@ namespace MonoDevelop.VersionControl.Subversion
public string Root {
get {
try {
- UriBuilder ub = new UriBuilder (Url);
- ub.Path = string.Empty;
- ub.Query = string.Empty;
- return ub.ToString ();
+ return new UriBuilder (Url) {
+ Path = string.Empty,
+ Query = string.Empty
+ }.ToString ();
} catch {
return string.Empty;
}
@@ -308,7 +305,7 @@ namespace MonoDevelop.VersionControl.Subversion
return (srcRepository is SubversionRepository) && ((SubversionRepository)srcRepository).Root == Root;
}
- protected override void OnMoveFile (FilePath localSrcPath, FilePath localDestPath, bool force, IProgressMonitor monitor)
+ protected override void OnMoveFile (FilePath localSrcPath, FilePath localDestPath, bool force, ProgressMonitor monitor)
{
bool destIsVersioned = false;
@@ -343,7 +340,7 @@ namespace MonoDevelop.VersionControl.Subversion
}
}
- protected override void OnMoveDirectory (FilePath localSrcPath, FilePath localDestPath, bool force, IProgressMonitor monitor)
+ protected override void OnMoveDirectory (FilePath localSrcPath, FilePath localDestPath, bool force, ProgressMonitor monitor)
{
if (IsVersioned (localDestPath))
{
@@ -434,7 +431,7 @@ namespace MonoDevelop.VersionControl.Subversion
}
}
- void MakeDirVersioned (string dir, IProgressMonitor monitor)
+ void MakeDirVersioned (string dir, ProgressMonitor monitor)
{
if (Directory.Exists (SubversionBackend.GetDirectoryDotSvn (VersionControlSystem, dir)))
return;
@@ -461,7 +458,7 @@ namespace MonoDevelop.VersionControl.Subversion
collection.Add(f);
}
- protected override void OnDeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
+ protected override void OnDeleteFiles (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal)
{
foreach (string path in localPaths) {
if (IsVersioned (path)) {
@@ -489,7 +486,7 @@ namespace MonoDevelop.VersionControl.Subversion
}
}
- protected override void OnDeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
+ protected override void OnDeleteDirectories (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal)
{
foreach (string path in localPaths) {
if (IsVersioned (path)) {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionVersionControl.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionVersionControl.cs
index 0ee35899fe..3ffd857b6f 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionVersionControl.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionVersionControl.cs
@@ -4,6 +4,7 @@ using System.IO;
using MonoDevelop.Core;
using MonoDevelop.VersionControl.Subversion.Gui;
+using System.Linq;
namespace MonoDevelop.VersionControl.Subversion
{
@@ -23,8 +24,6 @@ namespace MonoDevelop.VersionControl.Subversion
}
public abstract SubversionBackend CreateBackend ();
-
- public abstract string GetPathUrl (FilePath path);
public override Repository GetRepositoryReference (FilePath path, string id)
{
@@ -57,17 +56,12 @@ namespace MonoDevelop.VersionControl.Subversion
public Revision[] GetHistory (Repository repo, FilePath sourcefile, Revision since)
{
- List<Revision> revs = new List<Revision>();
-
SvnRevision startrev = SvnRevision.Working;
SvnRevision sincerev = SvnRevision.First;
if (since != null)
sincerev = (SvnRevision) since;
-
- foreach (SvnRevision rev in Log (repo, sourcefile, startrev, sincerev))
- revs.Add (rev);
-
- return revs.ToArray ();
+
+ return Log (repo, sourcefile, startrev, sincerev).ToArray ();
}
public abstract IEnumerable<SvnRevision> Log (Repository repo, FilePath path, SvnRevision revisionStart, SvnRevision revisionEnd);
@@ -110,9 +104,8 @@ namespace MonoDevelop.VersionControl.Subversion
return VersionInfo.CreateUnversioned (sourcefile, false);
if (!sourcefile.IsChildPathOf (srepo.RootPath))
return VersionInfo.CreateUnversioned (sourcefile, false);
-
- List<VersionInfo> statuses = new List<VersionInfo> ();
- statuses.AddRange (Status (repo, sourcefile, SvnRevision.Head, false, false, getRemoteStatus));
+
+ var statuses = new List<VersionInfo> (Status (repo, sourcefile, SvnRevision.Head, false, false, getRemoteStatus));
if (statuses.Count == 0)
return VersionInfo.CreateUnversioned (sourcefile, false);
@@ -120,7 +113,7 @@ namespace MonoDevelop.VersionControl.Subversion
if (statuses.Count != 1)
return VersionInfo.CreateUnversioned (sourcefile, false);
- VersionInfo ent = (VersionInfo) statuses[0];
+ VersionInfo ent = statuses [0];
if (ent.IsDirectory)
return VersionInfo.CreateUnversioned (sourcefile, false);
@@ -143,30 +136,28 @@ namespace MonoDevelop.VersionControl.Subversion
public VersionInfo[] GetDirectoryVersionInfo (Repository repo, FilePath sourcepath, bool getRemoteStatus, bool recursive)
{
- List<VersionInfo> list = new List<VersionInfo> ();
- list.AddRange (Status (repo, sourcepath, SvnRevision.Head, recursive, true, getRemoteStatus));
- return list.ToArray ();
+ return Status (repo, sourcepath, SvnRevision.Head, recursive, true, getRemoteStatus).ToArray ();
}
public abstract IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus);
- public abstract void Update (FilePath path, bool recurse, IProgressMonitor monitor);
+ public abstract void Update (FilePath path, bool recurse, ProgressMonitor monitor);
- public abstract void Commit (FilePath[] paths, string message, IProgressMonitor monitor);
+ public abstract void Commit (FilePath[] paths, string message, ProgressMonitor monitor);
- public abstract void Mkdir (string[] paths, string message, IProgressMonitor monitor);
+ public abstract void Mkdir (string[] paths, string message, ProgressMonitor monitor);
- public abstract void Checkout (string url, FilePath path, Revision rev, bool recurse, IProgressMonitor monitor);
+ public abstract void Checkout (string url, FilePath path, Revision rev, bool recurse, ProgressMonitor monitor);
- public abstract void Revert (FilePath[] paths, bool recurse, IProgressMonitor monitor);
+ public abstract void Revert (FilePath[] paths, bool recurse, ProgressMonitor monitor);
- public abstract void RevertRevision (FilePath path, Revision revision, IProgressMonitor monitor);
+ public abstract void RevertRevision (FilePath path, Revision revision, ProgressMonitor monitor);
- public abstract void RevertToRevision (FilePath path, Revision revision, IProgressMonitor monitor);
+ public abstract void RevertToRevision (FilePath path, Revision revision, ProgressMonitor monitor);
- public abstract void Add (FilePath path, bool recurse, IProgressMonitor monitor);
+ public abstract void Add (FilePath path, bool recurse, ProgressMonitor monitor);
- public abstract void Delete (FilePath path, bool force, IProgressMonitor monitor);
+ public abstract void Delete (FilePath path, bool force, ProgressMonitor monitor);
public abstract void Ignore (FilePath[] paths);
@@ -186,16 +177,16 @@ namespace MonoDevelop.VersionControl.Subversion
public abstract IEnumerable<DirectoryEntry> ListUrl (string url, bool recurse, SvnRevision rev);
- public void Move (FilePath srcPath, FilePath destPath, bool force, IProgressMonitor monitor)
+ public void Move (FilePath srcPath, FilePath destPath, bool force, ProgressMonitor monitor)
{
Move (srcPath, destPath, SvnRevision.Head, force, monitor);
}
- public abstract void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, IProgressMonitor monitor);
+ public abstract void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, ProgressMonitor monitor);
- public abstract void Lock (IProgressMonitor monitor, string comment, bool stealLock, params FilePath[] paths);
+ public abstract void Lock (ProgressMonitor monitor, string comment, bool stealLock, params FilePath[] paths);
- public abstract void Unlock (IProgressMonitor monitor, bool breakLock, params FilePath[] paths);
+ public abstract void Unlock (ProgressMonitor monitor, bool breakLock, params FilePath[] paths);
public string GetUnifiedDiff (FilePath path, bool recursive, bool remoteDiff)
{
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
index b9496598a4..95f58746ed 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
@@ -162,9 +162,10 @@ namespace MonoDevelop.VersionControl.Views
scroller.VscrollbarPolicy = PolicyType.Automatic;
filelist.RowActivated += OnRowActivated;
filelist.DiffLineActivated += OnDiffLineActivated;
+ filelist.CommitSelectionToggled += OnCommitSelectionToggled;
cellToggle = new CellRendererToggle();
- cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler);
+ cellToggle.Toggled += new ToggledHandler(OnCommitCellToggled);
var crc = new CellRendererImage ();
crc.StockId = "vc-comment";
colCommit = new TreeViewColumn ();
@@ -409,13 +410,14 @@ namespace MonoDevelop.VersionControl.Views
filelist.DoPopupMenu = null;
filelist.RowActivated -= OnRowActivated;
filelist.DiffLineActivated -= OnDiffLineActivated;
+ filelist.CommitSelectionToggled -= OnCommitSelectionToggled;
filelist.TestExpandRow -= OnTestExpandRow;
filelist.Selection.Changed -= OnCursorChanged;
filelist.Destroy ();
filelist = null;
}
if (cellToggle != null) {
- cellToggle.Toggled -= OnCommitToggledHandler;
+ cellToggle.Toggled -= OnCommitCellToggled;
cellToggle.Destroy ();
cellToggle = null;
}
@@ -455,7 +457,7 @@ namespace MonoDevelop.VersionControl.Views
ThreadPool.QueueUserWorkItem (delegate {
if (fileList != null) {
- var group = fileList.GroupBy (v => v.IsDirectory || v.WorkspaceObject is SolutionItem);
+ var group = fileList.GroupBy (v => v.IsDirectory || v.WorkspaceObject is SolutionFolderItem);
foreach (var item in group) {
// Is directory.
if (item.Key) {
@@ -710,11 +712,8 @@ namespace MonoDevelop.VersionControl.Views
OnOpen (null, null);
}
- void OnCommitToggledHandler(object o, ToggledArgs args) {
- TreeIter pos;
- if (!filestore.GetIterFromString (out pos, args.Path))
- return;
-
+ void ToggleCommitStatus(TreeIter pos)
+ {
string localpath = (string) filestore.GetValue (pos, ColFullPath);
if (changeSet.ContainsFile (localpath)) {
@@ -728,6 +727,20 @@ namespace MonoDevelop.VersionControl.Views
UpdateSelectionStatus ();
}
+ void OnCommitSelectionToggled (object sender, EventArgs e)
+ {
+ filelist.Selection.SelectedForeach((model, path, iter) => ToggleCommitStatus(iter));
+ }
+
+ void OnCommitCellToggled(object o, ToggledArgs args)
+ {
+ TreeIter pos;
+ if (!filestore.GetIterFromString (out pos, args.Path))
+ return;
+
+ ToggleCommitStatus (pos);
+ }
+
VersionInfo GetVersionInfo (string file)
{
foreach (VersionInfo vi in statuses)
@@ -1134,6 +1147,32 @@ namespace MonoDevelop.VersionControl.Views
{
const Gdk.ModifierType selectionModifiers = Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask;
+ protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
+ {
+ if (evnt.Key == Gdk.Key.Right || evnt.Key == Gdk.Key.KP_Right) {
+ Selection.SelectedForeach ((model, path, iter) => ExpandRow (path, true));
+ return true;
+ }
+
+ if (evnt.Key == Gdk.Key.Left || evnt.Key == Gdk.Key.KP_Left) {
+ Selection.SelectedForeach ((model, path, iter) => CollapseRow (path));
+ return true;
+ }
+
+ if (evnt.Key == Gdk.Key.space && CommitSelectionToggled != null) {
+ CommitSelectionToggled (this, EventArgs.Empty);
+ return true;
+ }
+
+ if (evnt.Key == Gdk.Key.Return || evnt.Key == Gdk.Key.KP_Enter) {
+ if (DiffLineActivated != null)
+ DiffLineActivated (this, EventArgs.Empty);
+ return true;
+ }
+
+ return base.OnKeyPressEvent (evnt);
+ }
+
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
bool keepPos = false;
@@ -1228,5 +1267,6 @@ namespace MonoDevelop.VersionControl.Views
public Action<Gdk.EventButton> DoPopupMenu;
public event EventHandler DiffLineActivated;
+ public event EventHandler CommitSelectionToggled;
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs
index 9808922e3d..b95b373dea 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs
@@ -48,10 +48,10 @@ namespace MonoDevelop.VersionControl.Views
if (document == null || !document.IsFile || document.Window.FindView<IDiffView> () >= 0)
return;
- IWorkspaceObject project = document.Project;
+ WorkspaceObject project = document.Project;
if (project == null) {
// Fix for broken .csproj and .sln files not being seen as having a project.
- foreach (var projItem in Ide.IdeApp.Workspace.GetAllSolutionItems<UnknownSolutionItem> ()) {
+ foreach (var projItem in Ide.IdeApp.Workspace.GetAllItems<UnknownSolutionItem> ()) {
if (projItem.FileName == document.FileName) {
project = projItem;
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
index 937b7abc9f..f4bf6413df 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
@@ -330,7 +330,6 @@
<Compile Include="MonoDevelop.VersionControl\Repository.cs" />
<Compile Include="MonoDevelop.VersionControl\RevertCommand.cs" />
<Compile Include="MonoDevelop.VersionControl\Revision.cs" />
- <Compile Include="MonoDevelop.VersionControl\Task.cs" />
<Compile Include="MonoDevelop.VersionControl\UnknownRepository.cs" />
<Compile Include="MonoDevelop.VersionControl\UpdateCommand.cs" />
<Compile Include="MonoDevelop.VersionControl\UrlBasedRepository.cs" />
@@ -396,6 +395,7 @@
<Compile Include="MonoDevelop.VersionControl.Dialogs\VersionControlSolutionOptionsPanel.cs" />
<Compile Include="AddinInfo.cs" />
<Compile Include="MonoDevelop.VersionControl\VersionControlException.cs" />
+ <Compile Include="MonoDevelop.VersionControl\VersionControlTask.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/AddRemoveMoveCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/AddRemoveMoveCommand.cs
index 70766591ea..60850e1c15 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/AddRemoveMoveCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/AddRemoveMoveCommand.cs
@@ -17,7 +17,7 @@ namespace MonoDevelop.VersionControl
return true;
}
- private class AddWorker : Task {
+ private class AddWorker : VersionControlTask {
VersionControlItemList items;
public AddWorker (VersionControlItemList items)
@@ -32,7 +32,7 @@ namespace MonoDevelop.VersionControl
protected override void Run ()
{
- IProgressMonitor monitor = Monitor;
+ ProgressMonitor monitor = Monitor;
foreach (VersionControlItemList list in items.SplitByRepository ())
list[0].Repository.Add (list.Paths, true, monitor);
@@ -108,7 +108,7 @@ namespace MonoDevelop.VersionControl
return true;
}
- private class RemoveWorker : Task {
+ private class RemoveWorker : VersionControlTask {
VersionControlItemList items;
public RemoveWorker (VersionControlItemList items) {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs
index 7ecd9340ed..7e03982d5a 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CheckoutCommand.cs
@@ -28,7 +28,7 @@ namespace MonoDevelop.VersionControl
}
}
- class CheckoutWorker : Task
+ class CheckoutWorker : VersionControlTask
{
Repository vc;
string path;
@@ -45,7 +45,7 @@ namespace MonoDevelop.VersionControl
return GettextCatalog.GetString ("Checking out {0}...", path);
}
- protected override IProgressMonitor CreateProgressMonitor ()
+ protected override ProgressMonitor CreateProgressMonitor ()
{
return new MonoDevelop.Core.ProgressMonitoring.AggregatedProgressMonitor (
base.CreateProgressMonitor (),
@@ -73,7 +73,7 @@ namespace MonoDevelop.VersionControl
return;
}
- if (Monitor.IsCancelRequested) {
+ if (Monitor.CancellationToken.IsCancellationRequested) {
Monitor.ReportSuccess (GettextCatalog.GetString ("Checkout operation cancelled"));
return;
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs
index 6c8d5abea3..5462cd8978 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs
@@ -37,7 +37,7 @@ namespace MonoDevelop.VersionControl
VersionControlItemList list = new VersionControlItemList ();
WorkspaceItem wob;
- SolutionItem sol;
+ SolutionFolderItem sol;
Repository repo = null;
wob = IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem;
if (wob != null)
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 f5257c5979..c3e6e4979c 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs
@@ -32,7 +32,7 @@ namespace MonoDevelop.VersionControl
}
}
- private class CommitWorker : Task
+ private class CommitWorker : VersionControlTask
{
Repository vc;
ChangeSet changeSet;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/IgnoreCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/IgnoreCommand.cs
index d9f74988ca..48297e4b43 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/IgnoreCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/IgnoreCommand.cs
@@ -62,7 +62,7 @@ namespace MonoDevelop.VersionControl
}
}
- private class IgnoreWorker : Task
+ private class IgnoreWorker : VersionControlTask
{
VersionControlItemList items;
@@ -125,7 +125,7 @@ namespace MonoDevelop.VersionControl
}
}
- private class UnignoreWorker : Task
+ private class UnignoreWorker : VersionControlTask
{
VersionControlItemList items;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/LockCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/LockCommand.cs
index 66507132e4..46cb65a80c 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/LockCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/LockCommand.cs
@@ -43,7 +43,7 @@ namespace MonoDevelop.VersionControl
return true;
}
- private class LockWorker : Task
+ private class LockWorker : VersionControlTask
{
VersionControlItemList items;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/PublishCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/PublishCommand.cs
index b636e7e3db..5dee5c58c9 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/PublishCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/PublishCommand.cs
@@ -10,7 +10,7 @@ namespace MonoDevelop.VersionControl
{
internal class PublishCommand
{
- public static bool Publish (IWorkspaceObject entry, FilePath localPath, bool test)
+ public static bool Publish (WorkspaceObject entry, FilePath localPath, bool test)
{
if (test)
return VersionControlService.CheckVersionControlInstalled () && VersionControlService.GetRepository (entry) == null;
@@ -52,7 +52,7 @@ namespace MonoDevelop.VersionControl
return true;
}
- static void GetFiles (List<FilePath> files, IWorkspaceObject entry)
+ static void GetFiles (List<FilePath> files, WorkspaceObject entry)
{
// Ensure that we strip out all linked files from outside of the solution/projects path.
if (entry is IWorkspaceFileObject)
@@ -69,7 +69,7 @@ namespace MonoDevelop.VersionControl
}
}
- internal class PublishWorker : Task {
+ internal class PublishWorker : VersionControlTask {
Repository vc;
FilePath path;
string moduleName;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs
index aef5e0dd2d..aca8706d1d 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs
@@ -372,6 +372,25 @@ namespace MonoDevelop.VersionControl
} catch (Exception ex) {
LoggingService.LogError ("Version control status query failed", ex);
+ //Release all items in current batch
+ foreach (var item in recursiveDirectoryQueryQueueClone)
+ item.ResetEvent.Set ();
+
+ lock (queryLock) {
+ queryRunning = false;
+
+ fileQueryQueue.Clear ();
+ filesInQueryQueue.Clear ();
+
+ directoriesInQueryQueue.Clear ();
+ directoryQueryQueue.Clear ();
+
+ recursiveDirectoryQueryQueueClone = recursiveDirectoryQueryQueue.ToArray ();
+ recursiveDirectoriesInQueryQueue.Clear ();
+ recursiveDirectoryQueryQueue.Clear ();
+ }
+
+ //Release newly pending
foreach (var item in recursiveDirectoryQueryQueueClone)
item.ResetEvent.Set ();
}
@@ -421,29 +440,29 @@ namespace MonoDevelop.VersionControl
// Imports a directory into the repository. 'serverPath' is the relative path in the repository.
// 'localPath' is the local directory to publish. 'files' is the list of files to add to the new
// repository directory (must use absolute local paths).
- public Repository Publish (string serverPath, FilePath localPath, FilePath[] files, string message, IProgressMonitor monitor)
+ public Repository Publish (string serverPath, FilePath localPath, FilePath[] files, string message, ProgressMonitor monitor)
{
var res = OnPublish (serverPath, localPath, files, message, monitor);
ClearCachedVersionInfo (localPath);
return res;
}
- protected abstract Repository OnPublish (string serverPath, FilePath localPath, FilePath[] files, string message, IProgressMonitor monitor);
+ protected abstract Repository OnPublish (string serverPath, FilePath localPath, FilePath[] files, string message, ProgressMonitor monitor);
// Updates a local file or directory from the repository
// Returns a list of updated files
- public void Update (FilePath localPath, bool recurse, IProgressMonitor monitor)
+ public void Update (FilePath localPath, bool recurse, ProgressMonitor monitor)
{
Update (new FilePath[] { localPath }, recurse, monitor);
}
- public void Update (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
+ public void Update (FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
{
OnUpdate (localPaths, recurse, monitor);
ClearCachedVersionInfo (localPaths);
}
- protected abstract void OnUpdate (FilePath[] localPaths, bool recurse, IProgressMonitor monitor);
+ protected abstract void OnUpdate (FilePath[] localPaths, bool recurse, ProgressMonitor monitor);
// Called to create a ChangeSet to be used for a commit operation
public virtual ChangeSet CreateChangeSet (FilePath basePath)
@@ -468,70 +487,70 @@ namespace MonoDevelop.VersionControl
}
// Commits changes in a set of files or directories into the repository
- public void Commit (ChangeSet changeSet, IProgressMonitor monitor)
+ public void Commit (ChangeSet changeSet, ProgressMonitor monitor)
{
ClearCachedVersionInfo (changeSet.BaseLocalPath);
OnCommit (changeSet, monitor);
}
- protected abstract void OnCommit (ChangeSet changeSet, IProgressMonitor monitor);
+ protected abstract void OnCommit (ChangeSet changeSet, ProgressMonitor monitor);
// Gets the contents of this repositories into the specified local path
- public void Checkout (FilePath targetLocalPath, bool recurse, IProgressMonitor monitor)
+ public void Checkout (FilePath targetLocalPath, bool recurse, ProgressMonitor monitor)
{
Checkout (targetLocalPath, null, recurse, monitor);
}
- public void Checkout (FilePath targetLocalPath, Revision rev, bool recurse, IProgressMonitor monitor)
+ public void Checkout (FilePath targetLocalPath, Revision rev, bool recurse, ProgressMonitor monitor)
{
ClearCachedVersionInfo (targetLocalPath);
OnCheckout (targetLocalPath, rev, recurse, monitor);
}
- protected abstract void OnCheckout (FilePath targetLocalPath, Revision rev, bool recurse, IProgressMonitor monitor);
+ protected abstract void OnCheckout (FilePath targetLocalPath, Revision rev, bool recurse, ProgressMonitor monitor);
- public void Revert (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
+ public void Revert (FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
{
ClearCachedVersionInfo (localPaths);
OnRevert (localPaths, recurse, monitor);
}
- public void Revert (FilePath localPath, bool recurse, IProgressMonitor monitor)
+ public void Revert (FilePath localPath, bool recurse, ProgressMonitor monitor)
{
Revert (new FilePath[] { localPath }, recurse, monitor);
}
- protected abstract void OnRevert (FilePath[] localPaths, bool recurse, IProgressMonitor monitor);
+ protected abstract void OnRevert (FilePath[] localPaths, bool recurse, ProgressMonitor monitor);
- public void RevertRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
+ public void RevertRevision (FilePath localPath, Revision revision, ProgressMonitor monitor)
{
ClearCachedVersionInfo (localPath);
OnRevertRevision (localPath, revision, monitor);
}
- protected abstract void OnRevertRevision (FilePath localPath, Revision revision, IProgressMonitor monitor);
+ protected abstract void OnRevertRevision (FilePath localPath, Revision revision, ProgressMonitor monitor);
- public void RevertToRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
+ public void RevertToRevision (FilePath localPath, Revision revision, ProgressMonitor monitor)
{
ClearCachedVersionInfo (localPath);
OnRevertToRevision (localPath, revision, monitor);
}
- protected abstract void OnRevertToRevision (FilePath localPath, Revision revision, IProgressMonitor monitor);
+ protected abstract void OnRevertToRevision (FilePath localPath, Revision revision, ProgressMonitor monitor);
// Adds a file or directory to the repository
- public void Add (FilePath localPath, bool recurse, IProgressMonitor monitor)
+ public void Add (FilePath localPath, bool recurse, ProgressMonitor monitor)
{
Add (new FilePath[] { localPath }, recurse, monitor);
}
- public void Add (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
+ public void Add (FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
{
OnAdd (localPaths, recurse, monitor);
ClearCachedVersionInfo (localPaths);
}
- protected abstract void OnAdd (FilePath[] localPaths, bool recurse, IProgressMonitor monitor);
+ protected abstract void OnAdd (FilePath[] localPaths, bool recurse, ProgressMonitor monitor);
// Returns true if the file can be moved from source location (and repository) to this repository
public virtual bool CanMoveFilesFrom (Repository srcRepository, FilePath localSrcPath, FilePath localDestPath)
@@ -545,57 +564,57 @@ namespace MonoDevelop.VersionControl
// For example, when moving a file to an unversioned directory, the implementation
// might just throw an exception, or it could version the directory, or it could
// ask the user what to do.
- public void MoveFile (FilePath localSrcPath, FilePath localDestPath, bool force, IProgressMonitor monitor)
+ public void MoveFile (FilePath localSrcPath, FilePath localDestPath, bool force, ProgressMonitor monitor)
{
ClearCachedVersionInfo (localSrcPath, localDestPath);
OnMoveFile (localSrcPath, localDestPath, force, monitor);
}
- protected virtual void OnMoveFile (FilePath localSrcPath, FilePath localDestPath, bool force, IProgressMonitor monitor)
+ protected virtual void OnMoveFile (FilePath localSrcPath, FilePath localDestPath, bool force, ProgressMonitor monitor)
{
File.Move (localSrcPath, localDestPath);
}
// Moves a directory. This method may be called for versioned and unversioned
// files. The default implementetions performs a system file move.
- public void MoveDirectory (FilePath localSrcPath, FilePath localDestPath, bool force, IProgressMonitor monitor)
+ public void MoveDirectory (FilePath localSrcPath, FilePath localDestPath, bool force, ProgressMonitor monitor)
{
ClearCachedVersionInfo (localSrcPath, localDestPath);
OnMoveDirectory (localSrcPath, localDestPath, force, monitor);
}
- protected virtual void OnMoveDirectory (FilePath localSrcPath, FilePath localDestPath, bool force, IProgressMonitor monitor)
+ protected virtual void OnMoveDirectory (FilePath localSrcPath, FilePath localDestPath, bool force, ProgressMonitor monitor)
{
- Directory.Move (localSrcPath, localDestPath);
+ FileService.SystemDirectoryRename (localSrcPath, localDestPath);
}
// Deletes a file or directory. This method may be called for versioned and unversioned
// files. The default implementetions performs a system file delete.
- public void DeleteFile (FilePath localPath, bool force, IProgressMonitor monitor, bool keepLocal = true)
+ public void DeleteFile (FilePath localPath, bool force, ProgressMonitor monitor, bool keepLocal = true)
{
DeleteFiles (new FilePath[] { localPath }, force, monitor, keepLocal);
}
- public void DeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal = true)
+ public void DeleteFiles (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal = true)
{
OnDeleteFiles (localPaths, force, monitor, keepLocal);
ClearCachedVersionInfo (localPaths);
}
- protected abstract void OnDeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal);
+ protected abstract void OnDeleteFiles (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal);
- public void DeleteDirectory (FilePath localPath, bool force, IProgressMonitor monitor, bool keepLocal = true)
+ public void DeleteDirectory (FilePath localPath, bool force, ProgressMonitor monitor, bool keepLocal = true)
{
DeleteDirectories (new FilePath[] { localPath }, force, monitor, keepLocal);
}
- public void DeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal = true)
+ public void DeleteDirectories (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal = true)
{
OnDeleteDirectories (localPaths, force, monitor, keepLocal);
ClearCachedVersionInfo (localPaths);
}
- protected abstract void OnDeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal);
+ protected abstract void OnDeleteDirectories (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal);
// Called to request write permission for a file. The file may not yet exist.
// After the file is modified or created, NotifyFileChanged is called.
@@ -620,26 +639,26 @@ namespace MonoDevelop.VersionControl
}
// Locks a file in the repository so no other users can change it
- public void Lock (IProgressMonitor monitor, params FilePath[] localPaths)
+ public void Lock (ProgressMonitor monitor, params FilePath[] localPaths)
{
ClearCachedVersionInfo (localPaths);
OnLock (monitor, localPaths);
}
// Locks a file in the repository so no other users can change it
- protected virtual void OnLock (IProgressMonitor monitor, params FilePath[] localPaths)
+ protected virtual void OnLock (ProgressMonitor monitor, params FilePath[] localPaths)
{
throw new System.NotSupportedException ();
}
// Unlocks a file in the repository so other users can change it
- public void Unlock (IProgressMonitor monitor, params FilePath[] localPaths)
+ public void Unlock (ProgressMonitor monitor, params FilePath[] localPaths)
{
ClearCachedVersionInfo (localPaths);
OnUnlock (monitor, localPaths);
}
- protected virtual void OnUnlock (IProgressMonitor monitor, params FilePath[] localPaths)
+ protected virtual void OnUnlock (ProgressMonitor monitor, params FilePath[] localPaths)
{
throw new System.NotSupportedException ();
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/RevertCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/RevertCommand.cs
index b69500f639..f49c902b47 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/RevertCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/RevertCommand.cs
@@ -43,7 +43,7 @@ namespace MonoDevelop.VersionControl
}
}
- private class RevertWorker : Task {
+ private class RevertWorker : VersionControlTask {
VersionControlItemList items;
public RevertWorker (VersionControlItemList items) {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/RevertRevisionsCommands.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/RevertRevisionsCommands.cs
index e0be0ad697..bf4fa3cf85 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/RevertRevisionsCommands.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/RevertRevisionsCommands.cs
@@ -75,7 +75,7 @@ namespace MonoDevelop.VersionControl
}
}
- private class RevertWorker : Task {
+ private class RevertWorker : VersionControlTask {
Repository vc;
string path;
Revision revision;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnknownRepository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnknownRepository.cs
index 030583d3ce..7735cab3f2 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnknownRepository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnknownRepository.cs
@@ -45,52 +45,52 @@ namespace MonoDevelop.VersionControl
}
- protected override Repository OnPublish (string serverPath, FilePath localPath, FilePath[] FilePath, string message, IProgressMonitor monitor)
+ protected override Repository OnPublish (string serverPath, FilePath localPath, FilePath[] FilePath, string message, ProgressMonitor monitor)
{
return null;
}
- protected override void OnUpdate (FilePath[] paths, bool recurse, IProgressMonitor monitor)
+ protected override void OnUpdate (FilePath[] paths, bool recurse, ProgressMonitor monitor)
{
}
- protected override void OnCommit (ChangeSet changeSet, IProgressMonitor monitor)
+ protected override void OnCommit (ChangeSet changeSet, ProgressMonitor monitor)
{
}
- protected override void OnCheckout (FilePath path, Revision rev, bool recurse, IProgressMonitor monitor)
+ protected override void OnCheckout (FilePath path, Revision rev, bool recurse, ProgressMonitor monitor)
{
}
- protected override void OnRevert (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
+ protected override void OnRevert (FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
{
}
- protected override void OnRevertRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
+ protected override void OnRevertRevision (FilePath localPath, Revision revision, ProgressMonitor monitor)
{
}
- protected override void OnRevertToRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
+ protected override void OnRevertToRevision (FilePath localPath, Revision revision, ProgressMonitor monitor)
{
}
- protected override void OnAdd (FilePath[] paths, bool recurse, IProgressMonitor monitor)
+ protected override void OnAdd (FilePath[] paths, bool recurse, ProgressMonitor monitor)
{
}
- protected override void OnMoveFile (FilePath srcPath, FilePath destPath, bool force, IProgressMonitor monitor)
+ protected override void OnMoveFile (FilePath srcPath, FilePath destPath, bool force, ProgressMonitor monitor)
{
}
- protected override void OnMoveDirectory (FilePath srcPath, FilePath destPath, bool force, IProgressMonitor monitor)
+ protected override void OnMoveDirectory (FilePath srcPath, FilePath destPath, bool force, ProgressMonitor monitor)
{
}
- protected override void OnDeleteFiles (FilePath[] path, bool force, IProgressMonitor monitor, bool keepLocal)
+ protected override void OnDeleteFiles (FilePath[] path, bool force, ProgressMonitor monitor, bool keepLocal)
{
}
- protected override void OnDeleteDirectories (FilePath[] path, bool force, IProgressMonitor monitor, bool keepLocal)
+ protected override void OnDeleteDirectories (FilePath[] path, bool force, ProgressMonitor monitor, bool keepLocal)
{
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnlockCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnlockCommand.cs
index 599e3d56f0..90b5cf4f79 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnlockCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnlockCommand.cs
@@ -45,7 +45,7 @@ namespace MonoDevelop.VersionControl
return true;
}
- private class UnlockWorker : Task
+ private class UnlockWorker : VersionControlTask
{
VersionControlItemList items;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UpdateCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UpdateCommand.cs
index 6677562bb1..838884e603 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UpdateCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UpdateCommand.cs
@@ -16,7 +16,7 @@ namespace MonoDevelop.VersionControl
return true;
}
- private class UpdateWorker : Task {
+ private class UpdateWorker : VersionControlTask {
VersionControlItemList items;
public UpdateWorker (VersionControlItemList items) {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlCommandHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlCommandHandler.cs
index ba12420ea5..009cfe0c50 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlCommandHandler.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlCommandHandler.cs
@@ -70,7 +70,7 @@ namespace MonoDevelop.VersionControl
{
string path;
bool isDir;
- IWorkspaceObject pentry;
+ WorkspaceObject pentry;
Repository repo;
VersionInfo versionInfo = null;
@@ -105,8 +105,8 @@ namespace MonoDevelop.VersionControl
path = item.FileName;
isDir = false;
pentry = item;
- } else if (obj is IWorkspaceObject) {
- pentry = ((IWorkspaceObject)obj);
+ } else if (obj is WorkspaceObject) {
+ pentry = ((WorkspaceObject)obj);
path = pentry.BaseDirectory;
isDir = true;
} else
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs
index 4f50281ce9..c77a27fdfc 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs
@@ -52,7 +52,7 @@ namespace MonoDevelop.VersionControl
public override void MoveFile (FilePath source, FilePath dest)
{
- IProgressMonitor monitor = new NullProgressMonitor ();
+ ProgressMonitor monitor = new ProgressMonitor ();
Repository srcRepo = GetRepository (source);
Repository dstRepo = GetRepository (dest);
@@ -78,7 +78,7 @@ namespace MonoDevelop.VersionControl
public override void DeleteFile (FilePath file)
{
Repository repo = GetRepository (file);
- repo.DeleteFile (file, true, new NullProgressMonitor (), false);
+ repo.DeleteFile (file, true, new ProgressMonitor (), false);
}
public override void CreateDirectory (FilePath path)
@@ -86,12 +86,12 @@ namespace MonoDevelop.VersionControl
Repository repo = GetRepository (path);
repo.ClearCachedVersionInfo (path);
System.IO.Directory.CreateDirectory (path);
- repo.Add (path, false, new NullProgressMonitor ());
+ repo.Add (path, false, new ProgressMonitor ());
}
public override void MoveDirectory (FilePath sourcePath, FilePath destPath)
{
- IProgressMonitor monitor = new NullProgressMonitor ();
+ ProgressMonitor monitor = new ProgressMonitor ();
Repository srcRepo = GetRepository (sourcePath);
Repository dstRepo = GetRepository (destPath);
@@ -107,7 +107,7 @@ namespace MonoDevelop.VersionControl
public override void DeleteDirectory (FilePath path)
{
Repository repo = GetRepository (path);
- repo.DeleteDirectory (path, true, new NullProgressMonitor (), false);
+ repo.DeleteDirectory (path, true, new ProgressMonitor (), false);
}
public override void RequestFileEdit (IEnumerable<FilePath> files)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlItem.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlItem.cs
index c8f3011f0d..7aa84c36ea 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlItem.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlItem.cs
@@ -35,11 +35,11 @@ namespace MonoDevelop.VersionControl
{
FilePath path;
bool isDirectory;
- IWorkspaceObject workspaceObject;
+ WorkspaceObject workspaceObject;
Repository repository;
VersionInfo versionInfo;
- public VersionControlItem (Repository repository, IWorkspaceObject workspaceObject, FilePath path, bool isDirectory, VersionInfo versionInfo)
+ public VersionControlItem (Repository repository, WorkspaceObject workspaceObject, FilePath path, bool isDirectory, VersionInfo versionInfo)
{
this.path = path;
this.repository = repository;
@@ -48,7 +48,7 @@ namespace MonoDevelop.VersionControl
this.versionInfo = versionInfo;
}
- public IWorkspaceObject WorkspaceObject {
+ public WorkspaceObject WorkspaceObject {
get {
return workspaceObject;
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs
index 848be5eba1..a2f9544638 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs
@@ -24,7 +24,7 @@ namespace MonoDevelop.VersionControl
return typeof(ProjectFile).IsAssignableFrom (dataType)
|| typeof(SystemFile).IsAssignableFrom (dataType)
|| typeof(ProjectFolder).IsAssignableFrom (dataType)
- || typeof(IWorkspaceObject).IsAssignableFrom (dataType);
+ || typeof(WorkspaceObject).IsAssignableFrom (dataType);
}
protected override void Initialize ()
@@ -46,8 +46,8 @@ namespace MonoDevelop.VersionControl
// Add status overlays
- if (dataObject is IWorkspaceObject) {
- IWorkspaceObject ce = (IWorkspaceObject) dataObject;
+ if (dataObject is WorkspaceObject) {
+ WorkspaceObject ce = (WorkspaceObject) dataObject;
Repository rep = VersionControlService.GetRepository (ce);
if (rep != null) {
rep.GetDirectoryVersionInfo (ce.BaseDirectory, false, false);
@@ -66,7 +66,7 @@ namespace MonoDevelop.VersionControl
return;
}
- IWorkspaceObject prj;
+ WorkspaceObject prj;
FilePath file;
if (dataObject is ProjectFile) {
@@ -202,8 +202,8 @@ namespace MonoDevelop.VersionControl
return ((ProjectFile) dataObject).FilePath;
} else if (dataObject is SystemFile) {
return ((SystemFile) dataObject).Path;
- } else if (dataObject is IWorkspaceObject) {
- return ((IWorkspaceObject)dataObject).BaseDirectory;
+ } else if (dataObject is WorkspaceObject) {
+ return ((WorkspaceObject)dataObject).BaseDirectory;
} else if (dataObject is ProjectFolder) {
return ((ProjectFolder)dataObject).Path;
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
index 9d204b4309..f994eb7cfd 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
@@ -185,7 +185,7 @@ namespace MonoDevelop.VersionControl
}
internal static Dictionary<Repository, InternalRepositoryReference> referenceCache = new Dictionary<Repository, InternalRepositoryReference> ();
- public static Repository GetRepository (IWorkspaceObject entry)
+ public static Repository GetRepository (WorkspaceObject entry)
{
if (IsGloballyDisabled)
return null;
@@ -437,6 +437,12 @@ namespace MonoDevelop.VersionControl
FileStatusChanged (null, args);
}
}
+
+ static bool ShouldAddFile (ProjectFileEventInfo info)
+ {
+ const ProjectItemFlags ignoreFlags = ProjectItemFlags.DontPersist | ProjectItemFlags.Hidden;
+ return (info.ProjectFile.Flags & ignoreFlags) != ignoreFlags;
+ }
//static void OnFileChanged (object s, ProjectFileEventArgs args)
//{
@@ -448,13 +454,14 @@ namespace MonoDevelop.VersionControl
static void OnFileAdded (object s, ProjectFileEventArgs e)
{
FileUpdateEventArgs vargs = new FileUpdateEventArgs ();
- IProgressMonitor monitor = null;
+ ProgressMonitor monitor = null;
try {
foreach (var repoFiles in e.GroupBy (i => i.Project)) {
Repository repo = GetRepository (repoFiles.Key);
if (repo == null)
continue;
- var versionInfos = repo.GetVersionInfo (repoFiles.Select (f => f.ProjectFile.FilePath), VersionInfoQueryFlags.IgnoreCache);
+ var filePaths = repoFiles.Where (ShouldAddFile).Select (f => f.ProjectFile.FilePath);
+ var versionInfos = repo.GetVersionInfo (filePaths, VersionInfoQueryFlags.IgnoreCache);
FilePath[] paths = versionInfos.Where (i => i.CanAdd).Select (i => i.LocalPath).ToArray ();
if (paths.Length > 0) {
if (monitor == null)
@@ -494,10 +501,10 @@ namespace MonoDevelop.VersionControl
}
}
*/
- static void SolutionItemAddFiles (string rootPath, SolutionItem entry, HashSet<string> files)
+ static void SolutionItemAddFiles (string rootPath, SolutionFolderItem entry, HashSet<string> files)
{
- if (entry is SolutionEntityItem) {
- foreach (var file in ((SolutionEntityItem)entry).GetItemFiles (false))
+ if (entry is SolutionItem) {
+ foreach (var file in ((SolutionItem)entry).GetItemFiles (false))
SolutionItemAddFile (rootPath, files, file);
}
@@ -507,7 +514,7 @@ namespace MonoDevelop.VersionControl
SolutionItemAddFile (rootPath, files, file.FilePath);
}
} else if (entry is SolutionFolder) {
- foreach (SolutionItem ent in ((SolutionFolder) entry).Items)
+ foreach (SolutionFolderItem ent in ((SolutionFolder) entry).Items)
SolutionItemAddFiles (rootPath, ent, files);
}
}
@@ -531,7 +538,7 @@ namespace MonoDevelop.VersionControl
return;
// handles addition of solutions and projects
- SolutionItem parent = (SolutionItem) args.SolutionItem.ParentFolder;
+ SolutionFolderItem parent = (SolutionFolderItem) args.SolutionItem.ParentFolder;
if (parent == null)
return;
@@ -541,7 +548,7 @@ namespace MonoDevelop.VersionControl
if (repo == null)
return;
- SolutionItem entry = args.SolutionItem;
+ SolutionFolderItem entry = args.SolutionItem;
Repository currentRepo = GetRepository (entry);
if (currentRepo != null && currentRepo.VersionControlSystem != repo.VersionControlSystem) {
// If the item is already under version control using a different version control system
@@ -558,7 +565,7 @@ namespace MonoDevelop.VersionControl
var files = new HashSet<string> { path };
SolutionItemAddFiles (path, entry, files);
- using (IProgressMonitor monitor = GetStatusMonitor ()) {
+ using (ProgressMonitor monitor = GetStatusMonitor ()) {
var status = repo.GetDirectoryVersionInfo (path, false, true);
foreach (var v in status) {
if (!v.IsVersioned && files.Contains (v.LocalPath))
@@ -572,12 +579,12 @@ namespace MonoDevelop.VersionControl
NotifyFileStatusChanged (new FileUpdateEventArgs (repo, parent.BaseDirectory, true));
}
- public static IProgressMonitor GetProgressMonitor (string operation)
+ public static ProgressMonitor GetProgressMonitor (string operation)
{
return GetProgressMonitor (operation, VersionControlOperationType.Other);
}
- public static IProgressMonitor GetProgressMonitor (string operation, VersionControlOperationType op)
+ public static ProgressMonitor GetProgressMonitor (string operation, VersionControlOperationType op)
{
IconId icon;
switch (op) {
@@ -586,7 +593,7 @@ namespace MonoDevelop.VersionControl
default: icon = "md-version-control"; break;
}
- IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor ("MonoDevelop.VersionControlOutput", "Version Control", "md-version-control", false, true);
+ ProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor ("MonoDevelop.VersionControlOutput", "Version Control", "md-version-control", false, true);
Pad outPad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor (monitor);
AggregatedProgressMonitor mon = new AggregatedProgressMonitor (monitor);
@@ -594,7 +601,7 @@ namespace MonoDevelop.VersionControl
return mon;
}
- static IProgressMonitor GetStatusMonitor ()
+ static ProgressMonitor GetStatusMonitor ()
{
return IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (GettextCatalog.GetString ("Updating version control repository"), "vc-remote-status", true);
}
@@ -736,7 +743,7 @@ namespace MonoDevelop.VersionControl
}
}
- public static CommitMessageFormat GetCommitMessageFormat (SolutionItem item)
+ public static CommitMessageFormat GetCommitMessageFormat (SolutionFolderItem item)
{
CommitMessageFormat format = new CommitMessageFormat ();
format.Style = item.Policies.Get<VersionControlPolicy> ().CommitMessageStyle;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Task.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlTask.cs
index 92aaac31c3..3ca1b9e2a5 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Task.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlTask.cs
@@ -6,9 +6,9 @@ using MonoDevelop.Core;
namespace MonoDevelop.VersionControl
{
- internal abstract class Task
+ internal abstract class VersionControlTask
{
- IProgressMonitor tracker;
+ ProgressMonitor tracker;
ThreadNotify threadnotify;
protected VersionControlOperationType OperationType { get; set; }
@@ -24,17 +24,17 @@ namespace MonoDevelop.VersionControl
{
}
- protected Task()
+ protected VersionControlTask()
{
OperationType = VersionControlOperationType.Other;
threadnotify = new ThreadNotify(new ReadyEvent(Wakeup));
}
- protected IProgressMonitor Monitor {
+ protected ProgressMonitor Monitor {
get { return tracker; }
}
- protected virtual IProgressMonitor CreateProgressMonitor ()
+ protected virtual ProgressMonitor CreateProgressMonitor ()
{
return VersionControlService.GetProgressMonitor (GetDescription (), OperationType);
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml b/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml
index 848fcc2200..18e0f0809b 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml
@@ -164,7 +164,7 @@
defaultHandler = "MonoDevelop.VersionControl.UnlockCommandHandler"
description = "Unlock files in the repository, so that other user can change them."/>
<Command id = "MonoDevelop.VersionControl.Commands.Annotate"
- _label = "Show Annotations"
+ _label = "Blame"
defaultHandler = "MonoDevelop.VersionControl.CurrentFileBlameHandler"
description = "Show the origin of each line in a file."/>
<Command id = "MonoDevelop.VersionControl.Commands.CreatePatch"
diff --git a/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs b/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs
index 667308fa8f..e7d8902ebc 100644
--- a/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs
+++ b/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs
@@ -41,14 +41,6 @@ namespace SubversionAddinWindows
return new SvnSharpBackend ();
}
- public override string GetPathUrl (FilePath path)
- {
- lock (client) {
- Uri u = client.Value.GetUriFromWorkingCopy (path);
- return u != null ? u.ToString () : null;
- }
- }
-
public override bool IsInstalled
{
get
@@ -69,7 +61,8 @@ namespace SubversionAddinWindows
{
string wc_path;
try {
- wc_path = client.Value.GetWorkingCopyRoot (path.FullPath);
+ lock (client.Value)
+ wc_path = client.Value.GetWorkingCopyRoot (path.FullPath);
return wc_path;
} catch (SvnException e) {
switch (e.SvnErrorCode) {
@@ -88,7 +81,7 @@ namespace SubversionAddinWindows
get { return SvnSharpClient.client.Value; }
}
- IProgressMonitor updateMonitor;
+ ProgressMonitor updateMonitor;
NotifData notifyData;
ProgressData progressData;
@@ -98,7 +91,8 @@ namespace SubversionAddinWindows
try {
// This outputs the contents of the base revision
// of a file to a stream.
- client.Write (new SvnPathTarget (sourcefile), data);
+ lock (client)
+ client.Write (new SvnPathTarget (sourcefile), data);
return TextFile.ReadFile (sourcefile, data).Text;
} catch (SvnIllegalTargetException e) {
// This occurs when we don't have a base file for
@@ -173,13 +167,14 @@ namespace SubversionAddinWindows
SslFailure acceptedFailures;
bool save;
- var certInfo = new CertficateInfo ();
- certInfo.AsciiCert = e.CertificateValue;
- certInfo.Fingerprint = e.Fingerprint;
- certInfo.HostName = e.CommonName;
- certInfo.IssuerName = e.Issuer;
- certInfo.ValidFrom = e.ValidFrom;
- certInfo.ValidUntil = e.ValidUntil;
+ var certInfo = new CertficateInfo {
+ AsciiCert = e.CertificateValue,
+ Fingerprint = e.Fingerprint,
+ HostName = e.CommonName,
+ IssuerName = e.Issuer,
+ ValidFrom = e.ValidFrom,
+ ValidUntil = e.ValidUntil,
+ };
e.Cancel = !SslServerTrustAuthenticationPrompt (e.Realm, (SslFailure) (uint) e.Failures, e.MaySave, certInfo, out acceptedFailures, out save);
@@ -205,23 +200,25 @@ namespace SubversionAddinWindows
e.CertificateFile = file;
}
- public override void Add (FilePath path, bool recurse, IProgressMonitor monitor)
+ public override void Add (FilePath path, bool recurse, ProgressMonitor monitor)
{
- var args = new SvnAddArgs ();
+ var args = new SvnAddArgs {
+ Depth = recurse ? SvnDepth.Infinity : SvnDepth.Empty,
+ };
BindMonitor (monitor);
- args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Empty;
lock (client)
client.Add (path, args);
}
- public override void Checkout (string url, FilePath path, Revision rev, bool recurse, IProgressMonitor monitor)
+ public override void Checkout (string url, FilePath path, Revision rev, bool recurse, ProgressMonitor monitor)
{
- var args = new SvnCheckOutArgs ();
+ var args = new SvnCheckOutArgs {
+ Depth = recurse ? SvnDepth.Infinity : SvnDepth.Empty,
+ };
BindMonitor (monitor);
- args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Empty;
lock (client) {
try {
- client.CheckOut (new SvnUriTarget (url, GetRevision (rev)), path);
+ client.CheckOut (new SvnUriTarget (url, GetRevision (rev)), path, args);
} catch (SvnOperationCanceledException) {
if (Directory.Exists (path.ParentDirectory))
FileService.DeleteDirectory (path.ParentDirectory);
@@ -229,20 +226,22 @@ namespace SubversionAddinWindows
}
}
- public override void Commit (FilePath[] paths, string message, IProgressMonitor monitor)
+ public override void Commit (FilePath[] paths, string message, ProgressMonitor monitor)
{
- var args = new SvnCommitArgs ();
+ var args = new SvnCommitArgs {
+ LogMessage = message,
+ };
BindMonitor (monitor);
- args.LogMessage = message;
lock (client)
client.Commit (paths.ToStringArray (), args);
}
- public override void Delete (FilePath path, bool force, IProgressMonitor monitor)
+ public override void Delete (FilePath path, bool force, ProgressMonitor monitor)
{
- var args = new SvnDeleteArgs ();
+ var args = new SvnDeleteArgs {
+ Force = force,
+ };
BindMonitor (monitor);
- args.Force = force;
lock (client)
client.Delete (path, args);
}
@@ -250,7 +249,9 @@ namespace SubversionAddinWindows
public override string GetTextAtRevision (string repositoryPath, Revision revision, string rootPath)
{
var ms = new MemoryStream ();
- SvnUriTarget target = client.GetUriFromWorkingCopy (rootPath);
+ SvnUriTarget target;
+ lock (client)
+ target = client.GetUriFromWorkingCopy (rootPath);
// Redo path link.
repositoryPath = repositoryPath.TrimStart (new [] { '/' });
foreach (var segment in target.Uri.Segments) {
@@ -279,7 +280,8 @@ namespace SubversionAddinWindows
public override string GetVersion ()
{
- return SvnClient.Version.ToString ();
+ lock (client)
+ return SvnClient.Version.ToString ();
}
public override IEnumerable<DirectoryEntry> ListUrl (string url, bool recurse, SvnRevision rev)
@@ -292,41 +294,42 @@ namespace SubversionAddinWindows
return List (new SvnPathTarget (path, GetRevision (rev)), recurse);
}
- IEnumerable<DirectoryEntry> List (SvnTarget target, bool recurse)
+ static IEnumerable<DirectoryEntry> List (SvnTarget target, bool recurse)
{
var list = new List<DirectoryEntry> ();
- var args = new SvnListArgs ();
- args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
+ var args = new SvnListArgs {
+ Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children,
+ };
lock (client)
client.List (target, args, delegate (object o, SvnListEventArgs a) {
- if (string.IsNullOrEmpty (a.Path))
- return;
- var de = new DirectoryEntry ();
- de.CreatedRevision = ToBaseRevision (a.Entry.Revision).Rev;
- de.HasProps = a.Entry.HasProperties;
- de.IsDirectory = a.Entry.NodeKind == SvnNodeKind.Directory;
- de.LastAuthor = a.Entry.Author;
- de.Name = a.Path;
- de.Size = a.Entry.FileSize;
- de.Time = a.Entry.Time;
- list.Add (de);
- });
+ if (string.IsNullOrEmpty (a.Path))
+ return;
+ list.Add (new DirectoryEntry {
+ CreatedRevision = ToBaseRevision (a.Entry.Revision).Rev,
+ HasProps = a.Entry.HasProperties,
+ IsDirectory = a.Entry.NodeKind == SvnNodeKind.Directory,
+ LastAuthor = a.Entry.Author,
+ Name = a.Path,
+ Size = a.Entry.FileSize,
+ Time = a.Entry.Time,
+ });
+ });
return list;
}
public override IEnumerable<SvnRevision> Log (Repository repo, FilePath path, SvnRevision revisionStart, SvnRevision revisionEnd)
{
var list = new List<SvnRevision> ();
- var args = new SvnLogArgs ();
- args.Range = new SvnRevisionRange (GetRevision (revisionStart), GetRevision (revisionEnd));
+ var args = new SvnLogArgs {
+ Range = new SvnRevisionRange (GetRevision (revisionStart), GetRevision (revisionEnd)),
+ };
lock (client)
client.Log (path, args, delegate (object o, SvnLogEventArgs a) {
var paths = new List<RevisionPath> ();
foreach (SvnChangeItem item in a.ChangedPaths) {
paths.Add (new RevisionPath (item.Path, ConvertRevisionAction (item.Action), ""));
}
- var r = new SvnRevision (repo, (int) a.Revision, a.Time, a.Author, a.LogMessage, paths.ToArray ());
- list.Add (r);
+ list.Add (new SvnRevision (repo, (int) a.Revision, a.Time, a.Author, a.LogMessage, paths.ToArray ()));
});
return list;
}
@@ -342,24 +345,26 @@ namespace SubversionAddinWindows
return RevisionAction.Other;
}
- public override void Mkdir (string[] paths, string message, IProgressMonitor monitor)
+ public override void Mkdir (string[] paths, string message, ProgressMonitor monitor)
{
- var args = new SvnCreateDirectoryArgs ();
- args.CreateParents = true;
+ var args = new SvnCreateDirectoryArgs {
+ CreateParents = true,
+ LogMessage = message,
+ };
BindMonitor (monitor);
var uris = new List<Uri> ();
foreach (string path in paths)
uris.Add (new Uri (path));
- args.LogMessage = message;
lock (client)
client.RemoteCreateDirectories (uris, args);
}
- public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, IProgressMonitor monitor)
+ public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, ProgressMonitor monitor)
{
- var args = new SvnMoveArgs ();
+ var args = new SvnMoveArgs {
+ Force = force,
+ };
BindMonitor (monitor);
- args.Force = force;
lock (client)
client.Move (srcPath, destPath, args);
}
@@ -368,27 +373,30 @@ namespace SubversionAddinWindows
{
var t1 = new SvnPathTarget (path1, GetRevision (revision1));
var t2 = new SvnPathTarget (path2, GetRevision (revision2));
- var args = new SvnDiffArgs ();
- args.Depth = recursive ? SvnDepth.Infinity : SvnDepth.Children;
- var ms = new MemoryStream ();
- lock (client)
- client.Diff (t1, t2, args, ms);
- ms.Position = 0;
- using (var sr = new StreamReader (ms)) {
- return sr.ReadToEnd ();
+ var args = new SvnDiffArgs {
+ Depth = recursive ? SvnDepth.Infinity : SvnDepth.Children,
+ };
+ using (var ms = new MemoryStream ()) {
+ lock (client)
+ client.Diff (t1, t2, args, ms);
+ ms.Position = 0;
+ using (var sr = new StreamReader (ms)) {
+ return sr.ReadToEnd ();
+ }
}
}
- public override void Revert (FilePath[] paths, bool recurse, IProgressMonitor monitor)
+ public override void Revert (FilePath[] paths, bool recurse, ProgressMonitor monitor)
{
- var args = new SvnRevertArgs ();
+ var args = new SvnRevertArgs {
+ Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children,
+ };
BindMonitor (monitor);
- args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
lock (client)
client.Revert (paths.ToStringArray (), args);
}
- public override void RevertRevision (FilePath path, Revision revision, IProgressMonitor monitor)
+ public override void RevertRevision (FilePath path, Revision revision, ProgressMonitor monitor)
{
var args = new SvnMergeArgs ();
BindMonitor (monitor);
@@ -398,7 +406,7 @@ namespace SubversionAddinWindows
client.Merge (path, new SvnPathTarget (path), range, args);
}
- public override void RevertToRevision (FilePath path, Revision revision, IProgressMonitor monitor)
+ public override void RevertToRevision (FilePath path, Revision revision, ProgressMonitor monitor)
{
var args = new SvnMergeArgs ();
BindMonitor (monitor);
@@ -410,11 +418,12 @@ namespace SubversionAddinWindows
public override IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus)
{
var list = new List<VersionInfo> ();
- var args = new SvnStatusArgs ();
- args.Revision = GetRevision (revision);
- args.Depth = descendDirs ? SvnDepth.Infinity : SvnDepth.Children;
- args.RetrieveAllEntries = !changedItemsOnly;
- args.RetrieveRemoteStatus = remoteStatus;
+ var args = new SvnStatusArgs {
+ Revision = GetRevision (revision),
+ Depth = descendDirs ? SvnDepth.Infinity : SvnDepth.Children,
+ RetrieveAllEntries = !changedItemsOnly,
+ RetrieveRemoteStatus = remoteStatus,
+ };
lock (client) {
try {
client.Status (path, args, (o, a) => list.Add (CreateVersionInfo (repo, a)));
@@ -497,31 +506,35 @@ namespace SubversionAddinWindows
return VersionStatus.Unversioned;
}
- public override void Lock (IProgressMonitor monitor, string comment, bool stealLock, params FilePath[] paths)
+ public override void Lock (ProgressMonitor monitor, string comment, bool stealLock, params FilePath[] paths)
{
- var args = new SvnLockArgs ();
+ var args = new SvnLockArgs {
+ Comment = comment,
+ StealLock = stealLock,
+ };
BindMonitor (monitor);
- args.Comment = comment;
- args.StealLock = stealLock;
lock (client)
client.Lock (paths.ToStringArray (), args);
}
- public override void Unlock (IProgressMonitor monitor, bool breakLock, params FilePath[] paths)
+ public override void Unlock (ProgressMonitor monitor, bool breakLock, params FilePath[] paths)
{
- var args = new SvnUnlockArgs ();
+ var args = new SvnUnlockArgs {
+ BreakLock = breakLock,
+ };
BindMonitor (monitor);
- args.BreakLock = breakLock;
lock (client)
client.Unlock (paths.ToStringArray (), args);
}
- public override void Update (FilePath path, bool recurse, IProgressMonitor monitor)
+ public override void Update (FilePath path, bool recurse, ProgressMonitor monitor)
{
- var args = new SvnUpdateArgs ();
+ var args = new SvnUpdateArgs {
+ Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children,
+ };
BindMonitor (monitor);
- args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
- client.Update (path, args);
+ lock (client)
+ client.Update (path, args);
}
public override void Ignore (FilePath[] paths)
@@ -556,22 +569,29 @@ namespace SubversionAddinWindows
throw new ArgumentNullException ();
var target = new SvnPathTarget (file, SharpSvn.SvnRevision.Base);
- var data = new MemoryStream ();
int numAnnotations = 0;
- client.Write (target, data);
-
- using (var reader = new StreamReader (data)) {
- reader.BaseStream.Seek (0, SeekOrigin.Begin);
- while (reader.ReadLine () != null)
- numAnnotations++;
+ using (var data = new MemoryStream ()) {
+ lock (client)
+ client.Write (target, data);
+
+ using (var reader = new StreamReader (data)) {
+ reader.BaseStream.Seek (0, SeekOrigin.Begin);
+ while (reader.ReadLine () != null)
+ numAnnotations++;
+ }
}
System.Collections.ObjectModel.Collection<SvnBlameEventArgs> list;
- var args = new SvnBlameArgs ();
- args.Start = GetRevision (revStart);
- args.End = GetRevision (revEnd);
+ var args = new SvnBlameArgs {
+ Start = GetRevision (revStart),
+ End = GetRevision (revEnd),
+ };
- if (client.GetBlame (target, args, out list)) {
+ bool success;
+ lock (client) {
+ success = client.GetBlame (target, args, out list);
+ }
+ if (success) {
var annotations = new Annotation [numAnnotations];
foreach (var annotation in list) {
if (annotation.LineNumber < annotations.Length)
@@ -633,7 +653,7 @@ namespace SubversionAddinWindows
public int Seconds;
}
- void BindMonitor (IProgressMonitor monitor)
+ void BindMonitor (ProgressMonitor monitor)
{
notifyData = new NotifData ();
progressData = new ProgressData ();
@@ -648,7 +668,7 @@ namespace SubversionAddinWindows
return String.Format ("{0:0.00} MBytes", kbytes / 1024.0);
}
- static void ProgressWork (SvnProgressEventArgs e, ProgressData data, IProgressMonitor monitor)
+ static void ProgressWork (SvnProgressEventArgs e, ProgressData data, ProgressMonitor monitor)
{
if (monitor == null)
return;
@@ -685,7 +705,7 @@ namespace SubversionAddinWindows
data.LogTimer.Start ();
}
- static void Notify (SvnNotifyEventArgs e, NotifData notifData, IProgressMonitor monitor)
+ static void Notify (SvnNotifyEventArgs e, NotifData notifData, ProgressMonitor monitor)
{
string actiondesc;
string file = e.Path;
diff --git a/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj b/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj
index d635660a89..5a78c6eb76 100644
--- a/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj
+++ b/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj
@@ -59,8 +59,11 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
- <Reference Include="SharpSvn, Version=1.8005.2778.15501, Culture=neutral, PublicKeyToken=d729672594885a28">
- <HintPath>..\..\..\..\external\sharpsvn-binary\SharpSvn.dll</HintPath>
+ <Reference Include="SharpSvn">
+ <HintPath>..\..\..\..\packages\SharpSvn.1.8-x86.1.8010.3345.53\lib\net40\SharpSvn.dll</HintPath>
+ </Reference>
+ <Reference Include="SharpSvn.UI">
+ <HintPath>..\..\..\..\packages\SharpSvn.1.8-x86.1.8010.3345.53\lib\net40\SharpSvn.UI.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -89,13 +92,13 @@
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
+ <PropertyGroup>
+ <NuGet>$(SolutionDir)\external\nuget-binary\NuGet.exe</NuGet>
+ <NuGet Condition="$(OS)=='Unix'">mono $(NuGet)</NuGet>
+ </PropertyGroup>
+ <Exec Command="$(NuGet) restore -SolutionDirectory $(SolutionDir)" />
</Target>
- <Target Name="AfterBuild">
- </Target>
- -->
<ItemGroup>
<ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
<Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
@@ -124,13 +127,14 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <None Include="..\..\..\..\external\sharpsvn-binary\SharpPlink-Win32.svnExe">
+ <None Include="..\..\..\..\packages\SharpSvn.1.8-x86.1.8010.3345.53\lib\net40\SharpPlink-Win32.svnExe">
<Link>SharpPlink-Win32.svnExe</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="..\..\..\..\external\sharpsvn-binary\SharpSvn-DB44-20-win32.svnDll">
+ <None Include="..\..\..\..\packages\SharpSvn.1.8-x86.1.8010.3345.53\lib\net40\SharpSvn-DB44-20-win32.svnDll">
<Link>SharpSvn-DB44-20-win32.svnDll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="packages.config" />
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/main/src/addins/VersionControl/Subversion.Win32/packages.config b/main/src/addins/VersionControl/Subversion.Win32/packages.config
new file mode 100644
index 0000000000..eead751a62
--- /dev/null
+++ b/main/src/addins/VersionControl/Subversion.Win32/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="SharpSvn.1.8-x86" version="1.8010.3345.53" targetFramework="net40" />
+</packages> \ No newline at end of file