Index: contrib/hook-scripts/svn2rss.py
===================================================================
--- contrib/hook-scripts/svn2rss.py	(revision 20347)
+++ contrib/hook-scripts/svn2rss.py	(working copy)
@@ -6,9 +6,10 @@
  -P | --svn-path=    path where svn binaries are installed
  -r | --revision=    svn revision
  -p | --repos-path=  svn repository to generate RSS 2.0 feed
- -u | --url=         link to appear in the rss item
+ -u | --item-url=    link to appear in the rss item
  -f | --rss-file=    filename to store the rss feed
  -m | --max-items=   maximum items to store in the rss feed
+ -U | --feed-url=    global RSS feed url 
 
 Generates a RSS 2.0 file containing commit information.  Once the
 maximum number of items is reached, older elements are removed.  The
@@ -34,9 +35,15 @@
     sys.exit(1)
 
 # All clear on the custom module checks.  Import some standard stuff.    
-import getopt, os, popen2, pickle, datetime
+import getopt, os, popen2, pickle, datetime, re
 from StringIO import StringIO
 
+# RSS feed URL patterns to match for '--item-url' and '--feed-url'
+url_res = [
+           re.compile(r'^http://'),
+           re.compile(r'^https://'),
+           re.compile(r'^file://'),
+          ]
 
 def usage_and_exit(errmsg=None):
     """Print a usage message, plus an ERRMSG (if provided), then exit.
@@ -51,15 +58,29 @@
         sys.exit(2)
     sys.exit(0)
 
+def match_url(url, opt):
+    """ match the url in url_res """
+
+    match = 0
+    for url_re in url_res:
+        if(url_re.match(url)):
+            match = 1
+
+    if(match == 0):
+        usage_and_exit("svn2rss.py: Invalid url '%s' is specified for \
+                        '%s' option" % (url, opt))
+
 if len(sys.argv) == 1:
     usage_and_exit("Not enough arguments provided.")
 try:
-    opts, args = getopt.gnu_getopt(sys.argv[1:],"hP:r:p:u:f:m:", [
+    opts, args = getopt.gnu_getopt(sys.argv[1:],"hP:r:p:u:f:m:U:", [
                                                       "help", "svn-path=",
                                                       "revision=",
-                                                      "repos-path=", "url=",
+                                                      "repos-path=",
+                                                      "item-url=",
                                                       "rss-file=",
-                                                      "max-items="])
+                                                      "max-items=",
+                                                      "feed-url="])
 except getopt.GetoptError, msg:
     usage_and_exit(msg)
 
@@ -75,8 +96,9 @@
         commit_rev = arg
     elif opt in ("-p", "--repos-path"):
         repos_path = arg
-    elif opt in ("-u", "--url"):
-        url = arg
+    elif opt in ("-u", "--item-url"):
+        item_url = arg
+        match_url(item_url, opt)
     elif opt in ("-f", "--rss-file"):
         rss_file = arg
     elif opt in ("-m", "--max-items"):
@@ -86,15 +108,20 @@
            usage_and_exit("Invalid value '%s' for --max-items." % (arg))
         if max_items < 1:
            usage_and_exit("Value for --max-items must be a positive integer.")
+    elif opt in ("-U", "--feed-url"):
+        feed_url = arg
+        match_url(feed_url, opt)
 
 class SVN2RSS:
-    def __init__(self, svn_path, revision, repos_path, url, rss_file, max_items):
+    def __init__(self, svn_path, revision, repos_path, item_url, rss_file, 
+                 max_items, feed_url):
         self.svn_path = svn_path
         self.revision = revision
         self.repos_path = repos_path
-        self.url = url
+        self.item_url = item_url
         self.rss_file = rss_file
         self.max_items = max_items
+        self.feed_url = feed_url
 
         self.rss_item_desc = self.make_rss_item_desc()
         self.svnlook = os.path.join(self.svn_path, "svnlook")
@@ -139,7 +166,7 @@
     def make_rss_item(self):
         """ Generate PyRSS2Gen Item from the commit info """
         item_title = "Revision " + self.revision
-        item_link = url + "?rev=" + self.revision
+        item_link = item_url + "?rev=" + self.revision
         rss_item = PyRSS2Gen.RSSItem(title = item_title,
                                      link = item_link,
                                      description = self.make_rss_item_desc(),
@@ -156,9 +183,10 @@
                 del(rss.items[self.max_items:])
         else:
             rss_item = self.rss_item
+            rss_title = "%s's SVN Commits Feed" % self.repos_path
             rss = PyRSS2Gen.RSS2(
-                              title = "Foo's SVN Commits Feed",
-                              link = "http://www.foo.com/project",
+                              title = rss_title,
+                              link = self.feed_url,
                               description = "The latest SVN commits",
                               lastBuildDate = datetime.datetime.now(),
                               items = [rss_item])
@@ -193,7 +221,8 @@
 
     for revision in revisions:
         revision = str(revision)
-        svn2rss = SVN2RSS(svn_path, revision, repos_path, url, rss_file, max_items)
+        svn2rss = SVN2RSS(svn_path, revision, repos_path, item_url, rss_file, 
+                          max_items, feed_url)
         rss = svn2rss.rss
         svn2rss.pickle()
 
