repoman: optimize svn keywords handling
authorZac Medico <zmedico@gentoo.org>
Wed, 27 Oct 2010 16:04:50 +0000 (09:04 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 27 Oct 2010 16:07:55 +0000 (09:07 -0700)
bin/repoman

index f21420e269c043506352da07c6e847cda2fb5fc3..1cd0adc5bb03dbdbdffda57ff6b0d6c8efdc0354 100755 (executable)
@@ -2217,7 +2217,8 @@ else:
                if vcs == 'cvs':
                        headerstring = "'\$(Header|Id).*\$'"
                elif vcs == "svn":
-                       svn_keywords = ["Rev",
+                       svn_keywords = dict((k.lower(), k) for k in [
+                                       "Rev",
                                        "Revision",
                                        "LastChangedRevision",
                                        "Date",
@@ -2227,7 +2228,8 @@ else:
                                        "URL",
                                        "HeadURL",
                                        "Id",
-                                       "Header"]
+                                       "Header",
+                       ])
 
                for myfile in myupdates:
 
@@ -2243,8 +2245,9 @@ else:
                                
                                # Subversion keywords are case-insensitive in svn:keywords properties, but case-sensitive in contents of files.
                                enabled_keywords = []
-                               for keyword in svn_keywords:
-                                       if keyword.lower() in (k.lower() for k in expansion[myfile]):
+                               for k in expansion[myfile]:
+                                       keyword = svn_keywords.get(k.lower())
+                                       if keyword is not None:
                                                enabled_keywords.append(keyword)
 
                                headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)