[mono/monodevelop] [3 commits] 9b78c8c4: Bug 16224 - Using "Review and Commit" command from Solution Pad version control sub-menu doubles commit entries.

"Therzok ([email protected])" <[email protected]> Fri, 15 Nov 2013 02:10:04 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <000001425985b7c5-5271504f-41e5-486a-bf93-cc634f48268e-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/43c2f7150cf4...3bb096d365c2

   Commit: 9b78c8c4822da551ca549d4444c3435db0dd2a1f
   Author: Therzok <[email protected]> (Therzok)
     Date: 2013-11-14 16:56:15 GMT
      URL: https://github.com/mono/monodevelop/commit/9b78c8c4822da551ca549d4444c3435db0dd2a1f

Bug 16224 - Using "Review and Commit" command from Solution Pad version control sub-menu doubles commit entries.

Changed paths:
  M main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/ChangeSet.cs

Modified: main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/ChangeSet.cs
===================================================================
@@ -61,7 +61,7 @@ public string GenerateGlobalComment (CommitMessageFormat format, MonoDevelop.Pro
 		public string GeneratePathComment (string path, IEnumerable<ChangeSetItem> items, 
 			CommitMessageFormat messageFormat, MonoDevelop.Projects.AuthorInformation userInfo)
 		{
-			ChangeLogWriter writer = new ChangeLogWriter (path, userInfo);
+			var writer = new ChangeLogWriter (path, userInfo);
 			writer.MessageFormat = messageFormat;
 			
 			foreach (ChangeSetItem item in items) {
@@ -85,8 +85,8 @@ public string GenerateGlobalComment (CommitMessageFormat format, MonoDevelop.Pro
 
 		public bool ContainsFile (FilePath fileName)
 		{
-			for (int n=0; n<items.Count; n++)
-				if (items [n].LocalPath == fileName)
+			foreach (var item in items)
+				if (item.LocalPath == fileName)
 					return true;
 			return false;
 		}
@@ -98,7 +98,11 @@ public ChangeSetItem AddFile (FilePath file)
 		
 		public ChangeSetItem AddFile (VersionInfo fileVersionInfo)
 		{
-			ChangeSetItem item = new ChangeSetItem (fileVersionInfo);
+			ChangeSetItem item = GetFileItem (fileVersionInfo.LocalPath);
+			if (item != null)
+				return item;
+
+			item = new ChangeSetItem (fileVersionInfo);
 			items.Add (item);
 			return item;
 		}
@@ -134,7 +138,7 @@ public void RemoveItem (ChangeSetItem item)
 		
 		public ChangeSet Clone ()
 		{
-			ChangeSet cs = (ChangeSet) MemberwiseClone ();
+			var cs = (ChangeSet) MemberwiseClone ();
 			cs.CopyFrom (this);
 			return cs;
 		}
@@ -184,7 +188,7 @@ internal ChangeSetItem (VersionInfo versionInfo)
 		
 		public ChangeSetItem Clone ()
 		{
-			ChangeSetItem cs = (ChangeSetItem) MemberwiseClone ();
+			var cs = (ChangeSetItem) MemberwiseClone ();
 			cs.CopyFrom (this);
 			return cs;
 		}

   Commit: d95889b68ae5f185c56cc7bc78c3e5a092098847
   Author: Therzok <[email protected]> (Therzok)
     Date: 2013-11-15 02:04:33 GMT
      URL: https://github.com/mono/monodevelop/commit/d95889b68ae5f185c56cc7bc78c3e5a092098847

Document the usage of List instead of HashSet.

Changed paths:
  M main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/ChangeSet.cs

Modified: main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/ChangeSet.cs
===================================================================
@@ -9,6 +9,8 @@ namespace MonoDevelop.VersionControl
 	public class ChangeSet
 	{
 		string globalComment = string.Empty;
+		// Commits should be atomic and small. Therefore having a List instead
+		// of a HashSet should be faster in most cases.
 		List<ChangeSetItem> items = new List<ChangeSetItem> ();
 		Repository repo;
 		FilePath basePath;

   Commit: 3bb096d365c228c0f5b8330f076081d96ce1f293
   Author: Ungureanu Marius <[email protected]> (Therzok)
     Date: 2013-11-15 02:05:55 GMT
      URL: https://github.com/mono/monodevelop/commit/3bb096d365c228c0f5b8330f076081d96ce1f293

Merge pull request #434 from mono/bug16224

Bug 16224 - Using "Review and Commit" command from Solution Pad version ...

Changed paths:
  M main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/ChangeSet.cs

Modified: main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/ChangeSet.cs
===================================================================
@@ -9,6 +9,8 @@ namespace MonoDevelop.VersionControl
 	public class ChangeSet
 	{
 		string globalComment = string.Empty;
+		// Commits should be atomic and small. Therefore having a List instead
+		// of a HashSet should be faster in most cases.
 		List<ChangeSetItem> items = new List<ChangeSetItem> ();
 		Repository repo;
 		FilePath basePath;
@@ -61,7 +63,7 @@ public string GenerateGlobalComment (CommitMessageFormat format, MonoDevelop.Pro
 		public string GeneratePathComment (string path, IEnumerable<ChangeSetItem> items, 
 			CommitMessageFormat messageFormat, MonoDevelop.Projects.AuthorInformation userInfo)
 		{
-			ChangeLogWriter writer = new ChangeLogWriter (path, userInfo);
+			var writer = new ChangeLogWriter (path, userInfo);
 			writer.MessageFormat = messageFormat;
 			
 			foreach (ChangeSetItem item in items) {
@@ -85,8 +87,8 @@ public string GenerateGlobalComment (CommitMessageFormat format, MonoDevelop.Pro
 
 		public bool ContainsFile (FilePath fileName)
 		{
-			for (int n=0; n<items.Count; n++)
-				if (items [n].LocalPath == fileName)
+			foreach (var item in items)
+				if (item.LocalPath == fileName)
 					return true;
 			return false;
 		}
@@ -98,7 +100,11 @@ public ChangeSetItem AddFile (FilePath file)
 		
 		public ChangeSetItem AddFile (VersionInfo fileVersionInfo)
 		{
-			ChangeSetItem item = new ChangeSetItem (fileVersionInfo);
+			ChangeSetItem item = GetFileItem (fileVersionInfo.LocalPath);
+			if (item != null)
+				return item;
+
+			item = new ChangeSetItem (fileVersionInfo);
 			items.Add (item);
 			return item;
 		}
@@ -134,7 +140,7 @@ public void RemoveItem (ChangeSetItem item)
 		
 		public ChangeSet Clone ()
 		{
-			ChangeSet cs = (ChangeSet) MemberwiseClone ();
+			var cs = (ChangeSet) MemberwiseClone ();
 			cs.CopyFrom (this);
 			return cs;
 		}
@@ -184,7 +190,7 @@ internal ChangeSetItem (VersionInfo versionInfo)
 		
 		public ChangeSetItem Clone ()
 		{
-			ChangeSetItem cs = (ChangeSetItem) MemberwiseClone ();
+			var cs = (ChangeSetItem) MemberwiseClone ();
 			cs.CopyFrom (this);
 			return cs;
 		}


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches