Sunday, January 08, 2006

Visual SourceSafe RSS Generator Bug Fix

I've downloaded Greg Reinacker's c# source to generate RSS feeds from Visual SourceSafe and improved it by reducing the working set. Following is the unified diff. (Be careful of wrapped lines when you select it into a text file.) If you need a tool to apply this diff, I recommend Tortise Merge which is a part of TortiseSVN which is a Windows shell extension for Subversion.



Index: GenRss.cs
===================================================================
--- GenRss.cs (revision 12)
+++ GenRss.cs (working copy)
@@ -91,29 +91,37 @@
foreach (SourceSafeTypeLib.IVSSVersion ver in versions)
{
i++;
- if (i > maxItems)
- continue;

- string action = ver.Action;
- string file = ver.VSSItem.Name;
- string user = ver.Username;
- string vernum = ver.VersionNumber.ToString();
- string comment = ver.Comment;
+ // Kevin Greiner (2/22/2005) The following loop is
+ // specifically written to allow the foreach to completely finish. Testing has
+ // shown that aborting the foreach prematurely increases the working set
+ // 10-fold.
+ if (i <= maxItems)
+ {
+
+ string action = ver.Action;
+ string file = ver.VSSItem.Name;
+ string user = ver.Username;
+ string vernum = ver.VersionNumber.ToString();
+ string comment = ver.Comment;

- DateTime dt = ver.Date;
+ DateTime dt = ver.Date;

- w.WriteStartElement("item");
- w.WriteElementString("title", String.Format("{0}/{1}", action, file));
- w.WriteStartElement("guid");
- w.WriteAttributeString("isPermaLink","false");
- w.WriteString(String.Format("{0}:{1}:{2}", file, vernum, action));
- w.WriteEndElement();
- w.WriteElementString("description", String.Format("{0}",comment));
- w.WriteElementString("pubDate", dt.ToUniversalTime().ToString("r"));
- w.WriteElementString("creator", "http://purl.org/dc/elements/1.1/", user);
- w.WriteEndElement(); // item
+ w.WriteStartElement("item");
+ w.WriteElementString("title", String.Format("{0}/{1}", action, file));
+ w.WriteStartElement("guid");
+ w.WriteAttributeString("isPermaLink","false");
+ w.WriteString(String.Format("{0}:{1}:{2}", file, vernum, action));
+ w.WriteEndElement();
+ w.WriteElementString("description", String.Format("{0}",comment));
+ w.WriteElementString("pubDate", dt.ToUniversalTime().ToString("r"));
+ w.WriteElementString("creator", "http://purl.org/dc/elements/1.1/", user);
+ w.WriteEndElement(); // item
+
+ }
+
+ Marshal.ReleaseComObject(ver);

- Marshal.ReleaseComObject(ver);
}

4 Comments:

Anonymous Anonymous said...

Any chance you can post a binary of your revised rssvsssvc? I don't have visual studio and don't know how to compile from source.

2/07/2006 12:51 PM  
Blogger Jonaric said...

Hey Kevin,

Did the source you downloaded come with the Interop.SourceSafeTypeLib.dll ? I am missing it, and cannot get this to work until I find that piece of the puzzle.

4/19/2006 11:07 AM  
Blogger Jonaric said...

Scratch that. I got it working.

However, now I am getting the following error:

"The SourceSafe database path USERNAME does not exist. Please select another database."

Looks like he is passing in the username as the database path? I'll check the source code.

4/19/2006 11:14 AM  
Blogger Stanislav said...

Can you please share the compiled binary with your changes ? Thank you in advance.

5/13/2010 3:44 AM  

Post a Comment

<< Home