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
path: root/main
diff options
context:
space:
mode:
authorTherzok <teromario@yahoo.com>2013-09-02 21:26:37 +0400
committerLluis Sanchez <lluis@xamarin.com>2013-09-06 21:41:33 +0400
commit5a7d4c7b74030789d1e74af74812e8ab8022eba5 (patch)
treeebccf85e746bdafce8499414358a0ad1801c0bc0 /main
parent2bb84dc75721d30197af71d5d3c9ffd61a501577 (diff)
[Version Control] Improved Unit Tests and Progress/Cancel commands.
*Renamed protected variables to use proper naming standard. *Setting Git author/email for repository so Blame can be evaluated. *Actually cache the GitRevision when doing status. *Fix ugly NREs when we don't have a monitor bound.
Diffstat (limited to 'main')
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs28
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs183
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/BaseSvnRepositoryTests.cs14
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/RepositoryTests.cs18
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32.Tests/RepositoryTests.cs10
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs8
7 files changed, 141 insertions, 124 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 fa37f1bdcd..842cf71269 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs
@@ -46,17 +46,17 @@ namespace MonoDevelop.VersionControl.Git.Tests
public override void Setup ()
{
// Generate directories and a svn util.
- rootUrl = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
- rootCheckout = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
- Directory.CreateDirectory (rootUrl.FullPath + "repo.git");
- repoLocation = "file:///" + rootUrl.FullPath + "repo.git";
+ RootUrl = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
+ RootCheckout = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
+ Directory.CreateDirectory (RootUrl.FullPath + "repo.git");
+ RepoLocation = "file:///" + RootUrl.FullPath + "repo.git";
// Initialize the bare repo.
InitCommand ci = new InitCommand ();
- ci.SetDirectory (new Sharpen.FilePath (rootUrl.FullPath + "repo.git"));
+ ci.SetDirectory (new Sharpen.FilePath (RootUrl.FullPath + "repo.git"));
ci.SetBare (true);
ci.Call ();
- FileRepository bare = new FileRepository (new Sharpen.FilePath (rootUrl.FullPath + "repo.git"));
+ FileRepository bare = new FileRepository (new Sharpen.FilePath (RootUrl.FullPath + "repo.git"));
string branch = Constants.R_HEADS + "master";
RefUpdate head = bare.UpdateRef (Constants.HEAD);
@@ -64,9 +64,9 @@ namespace MonoDevelop.VersionControl.Git.Tests
head.Link (branch);
// Check out the repository.
- Checkout (rootCheckout, repoLocation);
- repo = GetRepo (rootCheckout, repoLocation);
- DOT_DIR = ".git";
+ Checkout (RootCheckout, RepoLocation);
+ Repo = GetRepo (RootCheckout, RepoLocation);
+ DotDir= ".git";
}
protected override NUnit.Framework.Constraints.IResolveConstraint IsCorrectType ()
@@ -79,7 +79,7 @@ namespace MonoDevelop.VersionControl.Git.Tests
string difftext = @"@@ -0,0 +1 @@
+text
";
- Assert.AreEqual (difftext, repo.GenerateDiff (rootCheckout + "testfile", repo.GetVersionInfo (rootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content.Replace ("\n", "\r\n"));
+ Assert.AreEqual (difftext, Repo.GenerateDiff (RootCheckout + "testfile", Repo.GetVersionInfo (RootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content.Replace ("\n", "\r\n"));
}
[Test]
@@ -126,14 +126,14 @@ namespace MonoDevelop.VersionControl.Git.Tests
protected override Revision GetHeadRevision ()
{
- GitRepository repo2 = (GitRepository)repo;
+ GitRepository repo2 = (GitRepository)Repo;
RevWalk rw = new RevWalk (repo2.RootRepository);
ObjectId headId = repo2.RootRepository.Resolve (Constants.HEAD);
if (headId == null)
return null;
RevCommit commit = rw.ParseCommit (headId);
- GitRevision rev = new GitRevision (repo, repo2.RootRepository, commit.Id.Name);
+ GitRevision rev = new GitRevision (Repo, repo2.RootRepository, commit.Id.Name);
rev.Commit = commit;
return rev;
}
@@ -148,8 +148,8 @@ namespace MonoDevelop.VersionControl.Git.Tests
{
for (int i = 0; i < 2; i++) {
Assert.IsTrue (annotations [i].HasEmail);
- Assert.IsNotNull (annotations [i].Author);
- Assert.IsNotNull (annotations [i].Email);
+ Assert.AreEqual (Author, annotations [i].Author);
+ Assert.AreEqual (String.Format ("<{0}>", Email), annotations [i].Email);
}
Assert.IsTrue (annotations [2].HasDate);
}
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 ceb4b06ddb..cd7f9dd513 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs
@@ -37,14 +37,18 @@ namespace MonoDevelop.VersionControl.Tests
[TestFixture]
public abstract class BaseRepoUtilsTest
{
- protected string repoLocation = "";
- protected FilePath rootUrl = "";
- protected FilePath rootCheckout;
- protected Repository repo;
- protected Repository repo2;
- protected string DOT_DIR;
- protected List<string> addedItems = new List<string> ();
- protected int commitNumber = 0;
+ // [Git] Set user and email.
+ protected const string Author = "author";
+ protected const string Email = "email@service.domain";
+
+ protected string RepoLocation = "";
+ protected FilePath RootUrl = "";
+ protected FilePath RootCheckout;
+ protected Repository Repo;
+ protected Repository Repo2;
+ protected string DotDir;
+ protected List<string> AddedItems = new List<string> ();
+ protected int CommitNumber = 0;
[SetUp]
public abstract void Setup ();
@@ -52,17 +56,17 @@ namespace MonoDevelop.VersionControl.Tests
[TearDown]
public virtual void TearDown ()
{
- DeleteDirectory (rootUrl);
- DeleteDirectory (rootCheckout);
- addedItems.Clear ();
- commitNumber = 0;
+ DeleteDirectory (RootUrl);
+ DeleteDirectory (RootCheckout);
+ AddedItems.Clear ();
+ CommitNumber = 0;
}
[Test]
// Tests VersionControlService.GetRepositoryReference.
public void RightRepositoryDetection ()
{
- var path = ((string)rootCheckout).TrimEnd (Path.DirectorySeparatorChar);
+ var path = ((string)RootCheckout).TrimEnd (Path.DirectorySeparatorChar);
var repo = VersionControlService.GetRepositoryReference (path, null);
Assert.That (repo, IsCorrectType (), "#1");
@@ -75,12 +79,12 @@ namespace MonoDevelop.VersionControl.Tests
// Versioned file
AddFile ("foo", "contents", true, true);
- path = Path.Combine (rootCheckout, "foo");
+ path = Path.Combine (RootCheckout, "foo");
Assert.AreSame (VersionControlService.GetRepositoryReference (path, null), repo, "#2");
// Versioned directory
AddDirectory ("bar", true, true);
- path = Path.Combine (rootCheckout, "bar");
+ path = Path.Combine (RootCheckout, "bar");
Assert.AreSame (VersionControlService.GetRepositoryReference (path, null), repo, "#3");
// Unversioned file
@@ -92,11 +96,11 @@ namespace MonoDevelop.VersionControl.Tests
Assert.AreSame (VersionControlService.GetRepositoryReference (path, null), repo, "#5");
// Nonexistent file
- path = Path.Combine (rootCheckout, "do_i_exist");
+ path = Path.Combine (RootCheckout, "do_i_exist");
Assert.AreSame (VersionControlService.GetRepositoryReference (path, null), repo, "#6");
// Nonexistent directory
- path = Path.Combine (rootCheckout, "do", "i", "exist");
+ path = Path.Combine (RootCheckout, "do", "i", "exist");
Assert.AreSame (VersionControlService.GetRepositoryReference (path, null), repo, "#6");
}
@@ -106,7 +110,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.Checkout.
public void CheckoutExists ()
{
- Assert.IsTrue (Directory.Exists (rootCheckout + DOT_DIR));
+ Assert.IsTrue (Directory.Exists (RootCheckout + DotDir));
}
[Test]
@@ -115,7 +119,7 @@ namespace MonoDevelop.VersionControl.Tests
{
AddFile ("testfile", null, true, false);
- VersionInfo vi = repo.GetVersionInfo (rootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache);
+ VersionInfo vi = Repo.GetVersionInfo (RootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.Versioned, (VersionStatus.Versioned & vi.Status));
Assert.AreEqual (VersionStatus.ScheduledAdd, (VersionStatus.ScheduledAdd & vi.Status));
@@ -127,9 +131,9 @@ namespace MonoDevelop.VersionControl.Tests
public void FileIsCommitted ()
{
AddFile ("testfile", null, true, true);
- PostCommit (repo);
+ PostCommit (Repo);
- VersionInfo vi = repo.GetVersionInfo (rootCheckout + "testfile", VersionInfoQueryFlags.IncludeRemoteStatus | VersionInfoQueryFlags.IgnoreCache);
+ VersionInfo vi = Repo.GetVersionInfo (RootCheckout + "testfile", VersionInfoQueryFlags.IncludeRemoteStatus | VersionInfoQueryFlags.IgnoreCache);
// TODO: Fix Win32 Svn Remote status check.
Assert.AreEqual (VersionStatus.Versioned, (VersionStatus.Versioned & vi.Status));
}
@@ -143,24 +147,24 @@ namespace MonoDevelop.VersionControl.Tests
public virtual void UpdateIsDone ()
{
AddFile ("testfile", null, true, true);
- PostCommit (repo);
+ PostCommit (Repo);
// Checkout a second repository.
FilePath second = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
- Checkout (second, repoLocation);
- repo2 = GetRepo (second, repoLocation);
+ Checkout (second, RepoLocation);
+ Repo2 = GetRepo (second, RepoLocation);
string added = second + "testfile2";
File.Create (added).Close ();
- repo2.Add (added, false, new NullProgressMonitor ());
- ChangeSet changes = repo.CreateChangeSet (repo.RootPath);
- changes.AddFile (repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache));
+ Repo2.Add (added, false, new NullProgressMonitor ());
+ 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 NullProgressMonitor ());
- PostCommit (repo2);
+ PostCommit (Repo2);
- repo.Update (repo.RootPath, true, new NullProgressMonitor ());
- Assert.True (File.Exists (rootCheckout + "testfile2"));
+ Repo.Update (Repo.RootPath, true, new NullProgressMonitor ());
+ Assert.True (File.Exists (RootCheckout + "testfile2"));
DeleteDirectory (second);
}
@@ -172,7 +176,7 @@ namespace MonoDevelop.VersionControl.Tests
AddFile ("testfile", null, true, true);
AddFile ("testfile2", null, true, true);
int index = 0;
- foreach (Revision rev in repo.GetHistory (rootCheckout + "testfile", null)) {
+ foreach (Revision rev in Repo.GetHistory (RootCheckout + "testfile", null)) {
Assert.AreEqual (String.Format ("Commit #{0}", index++), rev.Message);
}
}
@@ -182,7 +186,7 @@ namespace MonoDevelop.VersionControl.Tests
public void DiffIsProper ()
{
AddFile ("testfile", null, true, true);
- File.AppendAllText (rootCheckout + "testfile", "text" + Environment.NewLine);
+ File.AppendAllText (RootCheckout + "testfile", "text" + Environment.NewLine);
TestDiff ();
}
@@ -195,12 +199,12 @@ namespace MonoDevelop.VersionControl.Tests
{
string content = "text";
AddFile ("testfile", null, true, true);
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
// Revert to head.
File.WriteAllText (added, content);
- repo.Revert (added, false, new NullProgressMonitor ());
- Assert.AreEqual (repo.GetBaseText (added), File.ReadAllText (added));
+ Repo.Revert (added, false, new NullProgressMonitor ());
+ Assert.AreEqual (Repo.GetBaseText (added), File.ReadAllText (added));
}
[Test]
@@ -209,7 +213,7 @@ namespace MonoDevelop.VersionControl.Tests
{
AddFile ("testfile", "text", true, true);
// TODO: Extend and test each member and more types.
- foreach (var rev in repo.GetRevisionChanges (GetHeadRevision ())) {
+ foreach (var rev in Repo.GetRevisionChanges (GetHeadRevision ())) {
Assert.AreEqual (rev.Action, RevisionAction.Add);
}
}
@@ -220,10 +224,10 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.RevertRevision.
public virtual void RevertsRevision ()
{
- string added = rootCheckout + "testfile2";
+ string added = RootCheckout + "testfile2";
AddFile ("testfile", "text", true, true);
AddFile ("testfile2", "text2", true, true);
- repo.RevertRevision (added, GetHeadRevision (), new NullProgressMonitor ());
+ Repo.RevertRevision (added, GetHeadRevision (), new NullProgressMonitor ());
Assert.IsFalse (File.Exists (added));
}
@@ -231,13 +235,13 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.MoveFile.
public virtual void MovesFile ()
{
- string src = rootCheckout + "testfile";
+ string src = RootCheckout + "testfile";
string dst = src + "2";
AddFile ("testfile", null, true, true);
- repo.MoveFile (src, dst, false, new NullProgressMonitor ());
- VersionInfo srcVi = repo.GetVersionInfo (src, VersionInfoQueryFlags.IgnoreCache);
- VersionInfo dstVi = repo.GetVersionInfo (dst, VersionInfoQueryFlags.IgnoreCache);
+ Repo.MoveFile (src, dst, false, new NullProgressMonitor ());
+ VersionInfo srcVi = Repo.GetVersionInfo (src, VersionInfoQueryFlags.IgnoreCache);
+ VersionInfo dstVi = Repo.GetVersionInfo (dst, VersionInfoQueryFlags.IgnoreCache);
const VersionStatus expectedStatus = VersionStatus.ScheduledDelete | VersionStatus.ScheduledReplace;
Assert.AreNotEqual (VersionStatus.Unversioned, srcVi.Status & expectedStatus);
Assert.AreEqual (VersionStatus.ScheduledAdd, dstVi.Status & VersionStatus.ScheduledAdd);
@@ -247,17 +251,17 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.MoveDirectory.
public virtual void MovesDirectory ()
{
- string srcDir = rootCheckout + "test";
- string dstDir = rootCheckout + "test2";
+ string srcDir = RootCheckout + "test";
+ string dstDir = RootCheckout + "test2";
string src = srcDir + Path.DirectorySeparatorChar + "testfile";
string dst = dstDir + Path.DirectorySeparatorChar + "testfile";
AddDirectory ("test", true, false);
AddFile ("test" + Path.DirectorySeparatorChar + "testfile", null, true, true);
- repo.MoveDirectory (srcDir, dstDir, false, new NullProgressMonitor ());
- VersionInfo srcVi = repo.GetVersionInfo (src, VersionInfoQueryFlags.IgnoreCache);
- VersionInfo dstVi = repo.GetVersionInfo (dst, VersionInfoQueryFlags.IgnoreCache);
+ Repo.MoveDirectory (srcDir, dstDir, false, new NullProgressMonitor ());
+ VersionInfo srcVi = Repo.GetVersionInfo (src, VersionInfoQueryFlags.IgnoreCache);
+ VersionInfo dstVi = Repo.GetVersionInfo (dst, VersionInfoQueryFlags.IgnoreCache);
const VersionStatus expectedStatus = VersionStatus.ScheduledDelete | VersionStatus.ScheduledReplace;
Assert.AreNotEqual (VersionStatus.Unversioned, srcVi.Status & expectedStatus);
Assert.AreEqual (VersionStatus.ScheduledAdd, dstVi.Status & VersionStatus.ScheduledAdd);
@@ -268,10 +272,10 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.DeleteFile.
public void DeletesFile ()
{
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
AddFile ("testfile", null, true, true);
- repo.DeleteFile (added, true, new NullProgressMonitor ());
- VersionInfo vi = repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
+ Repo.DeleteFile (added, true, new NullProgressMonitor ());
+ VersionInfo vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.ScheduledDelete, vi.Status & VersionStatus.ScheduledDelete);
}
@@ -279,13 +283,13 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.DeleteDirectory.
public virtual void DeletesDirectory ()
{
- string addedDir = rootCheckout + "test";
+ string addedDir = RootCheckout + "test";
string added = addedDir + Path.DirectorySeparatorChar + "testfile";
AddDirectory ("test", true, false);
AddFile ("testfile", null, true, true);
- repo.DeleteDirectory (addedDir, true, new NullProgressMonitor ());
- VersionInfo vi = repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
+ Repo.DeleteDirectory (addedDir, true, new NullProgressMonitor ());
+ VersionInfo vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.ScheduledDelete, vi.Status & VersionStatus.ScheduledDelete);
}
@@ -293,9 +297,9 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.Lock.
public virtual void LocksEntities ()
{
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
AddFile ("testfile", null, true, true);
- repo.Lock (new NullProgressMonitor (), added);
+ Repo.Lock (new NullProgressMonitor (), added);
PostLock ();
}
@@ -308,10 +312,10 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.Unlock.
public virtual void UnlocksEntities ()
{
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
AddFile ("testfile", null, true, true);
- repo.Lock (new NullProgressMonitor (), "testfile");
- repo.Unlock (new NullProgressMonitor (), added);
+ Repo.Lock (new NullProgressMonitor (), "testfile");
+ Repo.Unlock (new NullProgressMonitor (), added);
PostLock ();
}
@@ -324,10 +328,10 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.Ignore
public virtual void IgnoresEntities ()
{
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
AddFile ("testfile", null, false, false);
- repo.Ignore (new FilePath[] { added });
- VersionInfo vi = repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
+ Repo.Ignore (new FilePath[] { added });
+ VersionInfo vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.Ignored, vi.Status & VersionStatus.Ignored);
}
@@ -335,11 +339,11 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.Unignore
public virtual void UnignoresEntities ()
{
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
AddFile ("testfile", null, false, false);
- repo.Ignore (new FilePath[] { added });
- repo.Unignore (new FilePath[] { added });
- VersionInfo vi = repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
+ Repo.Ignore (new FilePath[] { added });
+ Repo.Unignore (new FilePath[] { added });
+ VersionInfo vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.Unversioned, vi.Status);
}
@@ -351,11 +355,11 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.GetTextAtRevision.
public void CorrectTextAtRevision ()
{
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
AddFile ("testfile", "text1", true, true);
File.AppendAllText (added, "text2");
CommitFile (added);
- string text = repo.GetTextAtRevision (rootCheckout, GetHeadRevision ());
+ string text = Repo.GetTextAtRevision (RootCheckout, GetHeadRevision ());
Assert.AreEqual ("text1text2", text);
}
@@ -364,7 +368,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.GetAnnotations.
public void BlameIsCorrect ()
{
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
// Initial commit.
AddFile ("testfile", "blah" + Environment.NewLine, true, true);
// Second commit.
@@ -373,7 +377,7 @@ namespace MonoDevelop.VersionControl.Tests
// Working copy.
File.AppendAllText (added, "wut2" + Environment.NewLine);
- var annotations = repo.GetAnnotations (added);
+ var annotations = Repo.GetAnnotations (added);
for (int i = 0; i < 2; i++) {
var annotation = annotations [i];
Assert.IsTrue (annotation.HasDate);
@@ -397,30 +401,35 @@ namespace MonoDevelop.VersionControl.Tests
{
Repository _repo = GetRepo (path, url);
_repo.Checkout (path, true, new NullProgressMonitor ());
- if (repo == null)
- repo = _repo;
+ if (Repo == null)
+ Repo = _repo;
else
- repo2 = _repo;
+ Repo2 = _repo;
}
protected void CommitItems ()
{
- ChangeSet changes = repo.CreateChangeSet (repo.RootPath);
- foreach (var item in addedItems) {
- changes.AddFile (repo.GetVersionInfo (item, VersionInfoQueryFlags.IgnoreCache));
+ ChangeSet changes = Repo.CreateChangeSet (Repo.RootPath);
+ foreach (var item in AddedItems) {
+ changes.AddFile (Repo.GetVersionInfo (item, VersionInfoQueryFlags.IgnoreCache));
}
- changes.GlobalComment = String.Format ("Commit #{0}", commitNumber);
- repo.Commit (changes, new NullProgressMonitor ());
- commitNumber++;
+ changes.GlobalComment = String.Format ("Commit #{0}", CommitNumber);
+ Repo.Commit (changes, new NullProgressMonitor ());
+ CommitNumber++;
}
protected void CommitFile (string path)
{
- ChangeSet changes = repo.CreateChangeSet (repo.RootPath);
- changes.AddFile (repo.GetVersionInfo (path, VersionInfoQueryFlags.IgnoreCache));
- changes.GlobalComment = String.Format ("Commit #{0}", commitNumber);
- repo.Commit (changes, new NullProgressMonitor ());
- commitNumber++;
+ ChangeSet changes = Repo.CreateChangeSet (Repo.RootPath);
+
+ // [Git] Needed by build bots.
+ changes.ExtendedProperties.Add ("Git.AuthorName", "author");
+ changes.ExtendedProperties.Add ("Git.AuthorEmail", "email@service.domain");
+
+ changes.AddFile (Repo.GetVersionInfo (path, VersionInfoQueryFlags.IgnoreCache));
+ changes.GlobalComment = String.Format ("Commit #{0}", CommitNumber);
+ Repo.Commit (changes, new NullProgressMonitor ());
+ CommitNumber++;
}
protected void AddFile (string path, string contents, bool toVcs, bool commit)
@@ -435,19 +444,19 @@ namespace MonoDevelop.VersionControl.Tests
void AddToRepository (string relativePath, string contents, bool toVcs, bool commit)
{
- string added = Path.Combine (rootCheckout, relativePath);
+ string added = Path.Combine (RootCheckout, relativePath);
if (contents == null)
Directory.CreateDirectory (added);
else
File.WriteAllText (added, contents);
if (toVcs)
- repo.Add (added, false, new NullProgressMonitor ());
+ Repo.Add (added, false, new NullProgressMonitor ());
if (commit)
CommitFile (added);
else
- addedItems.Add (added);
+ AddedItems.Add (added);
}
protected abstract Repository GetRepo (string path, string url);
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 5e636db065..af798f2ab0 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
@@ -319,8 +319,10 @@ namespace MonoDevelop.VersionControl.Git
if (versionInfoCacheRepository == null || versionInfoCacheRepository != repository) {
versionInfoCacheRepository = repository;
RevCommit headCommit = GetHeadCommit (repository);
- if (headCommit != null)
+ if (headCommit != null) {
rev = new GitRevision (this, repository, headCommit.Id.Name);
+ versionInfoCacheRevision = rev;
+ }
} else
rev = versionInfoCacheRevision;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/BaseSvnRepositoryTests.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/BaseSvnRepositoryTests.cs
index 5b0c12ede4..37a80b7382 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/BaseSvnRepositoryTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/BaseSvnRepositoryTests.cs
@@ -44,13 +44,13 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
ProcessStartInfo info;
// Generate directories and a svn util.
- rootCheckout = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
+ RootCheckout = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
// Create repo in "repo".
svnAdmin = new Process ();
info = new ProcessStartInfo ();
info.FileName = "svnadmin";
- info.Arguments = "create " + rootUrl + Path.DirectorySeparatorChar + "repo";
+ info.Arguments = "create " + RootUrl + Path.DirectorySeparatorChar + "repo";
info.WindowStyle = ProcessWindowStyle.Hidden;
svnAdmin.StartInfo = info;
svnAdmin.Start ();
@@ -62,13 +62,13 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
if (svnServe != null) {
info = new ProcessStartInfo ();
info.FileName = "svnserve";
- info.Arguments = "-dr " + rootUrl;
+ info.Arguments = "-dr " + RootUrl;
info.WindowStyle = ProcessWindowStyle.Hidden;
svnServe.StartInfo = info;
svnServe.Start ();
// Create user to auth.
- using (var perm = File. CreateText (rootUrl + Path.DirectorySeparatorChar + "repo" +
+ using (var perm = File. CreateText (RootUrl + Path.DirectorySeparatorChar + "repo" +
Path.DirectorySeparatorChar + "conf" + Path.DirectorySeparatorChar + "svnserve.conf")) {
perm.WriteLine ("[general]");
perm.WriteLine ("anon-access = write");
@@ -77,9 +77,9 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
}
// Check out the repository.
- Checkout (rootCheckout, repoLocation);
- repo = GetRepo (rootCheckout, repoLocation);
- DOT_DIR = ".svn";
+ Checkout (RootCheckout, RepoLocation);
+ Repo = GetRepo (RootCheckout, RepoLocation);
+ DotDir = ".svn";
}
[Test]
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/RepositoryTests.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/RepositoryTests.cs
index c8c15922a1..5e48c0a8bf 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/RepositoryTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/RepositoryTests.cs
@@ -39,18 +39,18 @@ namespace VersionControl.Subversion.Unix.Tests
public class UnixSvnUtilsTest : MonoDevelop.VersionControl.Subversion.Tests.BaseSvnUtilsTest
{
SubversionBackend SvnClient {
- get { return repo.Svn; }
+ get { return Repo.Svn; }
}
- new SubversionRepository repo {
- get { return (SubversionRepository) base.repo; }
+ new SubversionRepository Repo {
+ get { return (SubversionRepository) base.Repo; }
}
[SetUp]
public override void Setup ()
{
- rootUrl = new FilePath (FileService.CreateTempDirectory ());
- repoLocation = "file://" + rootUrl + "/repo";
+ RootUrl = new FilePath (FileService.CreateTempDirectory ());
+ RepoLocation = "file://" + RootUrl + "/repo";
base.Setup ();
}
@@ -59,7 +59,7 @@ namespace VersionControl.Subversion.Unix.Tests
{
AddFile ("test", "data", true, true);
AddDirectory ("foo", true, true);
- var items = SvnClient.ListUrl (repo.Url, false).ToArray ();
+ var items = SvnClient.ListUrl (Repo.Url, false).ToArray ();
Assert.AreEqual (2, items.Length, "#1");
Assert.IsTrue (items.Any (item => item.Name == "test" && !item.IsDirectory), "#2a");
Assert.IsTrue (items.Any (item => item.Name == "foo" && item.IsDirectory), "#2b");
@@ -72,7 +72,7 @@ namespace VersionControl.Subversion.Unix.Tests
@@ -0,0 +1 @@
+text
";
- Assert.AreEqual (difftext, repo.GenerateDiff (rootCheckout + "testfile", repo.GetVersionInfo (rootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content);
+ Assert.AreEqual (difftext, Repo.GenerateDiff (RootCheckout + "testfile", Repo.GetVersionInfo (RootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content);
}
// Tests that fail due to Subversion giving wrong data.
@@ -106,7 +106,7 @@ namespace VersionControl.Subversion.Unix.Tests
protected override void PostLock ()
{
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
Assert.Throws<Exception> (delegate {
File.WriteAllText (added, "text");
});
@@ -121,7 +121,7 @@ namespace VersionControl.Subversion.Unix.Tests
protected override void PostUnlock ()
{
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
Assert.DoesNotThrow (delegate {
File.WriteAllText (added, "text");
});
diff --git a/main/src/addins/VersionControl/Subversion.Win32.Tests/RepositoryTests.cs b/main/src/addins/VersionControl/Subversion.Win32.Tests/RepositoryTests.cs
index 77716d565f..5b6d00c253 100644
--- a/main/src/addins/VersionControl/Subversion.Win32.Tests/RepositoryTests.cs
+++ b/main/src/addins/VersionControl/Subversion.Win32.Tests/RepositoryTests.cs
@@ -41,8 +41,8 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
[SetUp]
public override void Setup ()
{
- rootUrl = new FilePath (FileService.CreateTempDirectory ());
- repoLocation = "svn://localhost:3690/repo";
+ RootUrl = new FilePath (FileService.CreateTempDirectory ());
+ RepoLocation = "svn://localhost:3690/repo";
svnServe = new Process ();
base.Setup ();
}
@@ -62,7 +62,7 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
@@ -0,0 +1 @@
+text
";
- Assert.AreEqual (difftext, repo.GenerateDiff (rootCheckout + "testfile", repo.GetVersionInfo (rootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content.Replace ("\n", "\r\n"));
+ Assert.AreEqual (difftext, Repo.GenerateDiff (RootCheckout + "testfile", Repo.GetVersionInfo (RootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content.Replace ("\n", "\r\n"));
}
// Tests that fail due to SvnSharp giving wrong data.
@@ -96,7 +96,7 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
protected override void PostLock ()
{
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
Assert.Throws<Exception> (delegate {
File.WriteAllText (added, "text");
});
@@ -111,7 +111,7 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
protected override void PostUnlock ()
{
- string added = rootCheckout + "testfile";
+ string added = RootCheckout + "testfile";
Assert.DoesNotThrow (delegate {
File.WriteAllText (added, "text");
});
diff --git a/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs b/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs
index a764ce9110..7896ceacf9 100644
--- a/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs
+++ b/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs
@@ -113,9 +113,15 @@ namespace SubversionAddinWindows
client.Authentication.UserNameHandlers += new EventHandler<SvnUserNameEventArgs> (AuthenticationUserNameHandlers);
client.Authentication.UserNamePasswordHandlers += new EventHandler<SvnUserNamePasswordEventArgs> (AuthenticationUserNamePasswordHandlers);
client.Progress += delegate (object sender, SvnProgressEventArgs e) {
+ if (updateMonitor == null)
+ return;
+
ProgressWork (e, progressData, updateMonitor);
};
client.Cancel += delegate (object o, SvnCancelEventArgs a) {
+ if (updateMonitor == null)
+ return;
+
a.Cancel = updateMonitor.IsCancelRequested;
};
}
@@ -194,7 +200,7 @@ namespace SubversionAddinWindows
lock (client) {
try {
client.CheckOut (new SvnUriTarget (url, GetRevision (rev)), path);
- } catch (SvnOperationCanceledException e) {
+ } catch (SvnOperationCanceledException) {
if (Directory.Exists (path.ParentDirectory))
FileService.DeleteDirectory (path.ParentDirectory);
}