changeset 23:425a3c73ac1d

add a convenience method for VCS sources
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 30 May 2011 14:22:22 -0700
parents 1378e96c65ac
children 88f3d83eb858
files buttercup/source.py
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/buttercup/source.py	Mon May 30 14:06:29 2011 -0700
+++ b/buttercup/source.py	Mon May 30 14:22:22 2011 -0700
@@ -57,3 +57,16 @@
             # TODO: add a more intelligent .git/config
 
     __call__ = update
+
+def VCS_sources(source_dict, **kwargs):
+    retval = []
+    for repo_type, sources in source_dict.items():
+        if repo_type == 'hg':
+            retval.extend([HgSource(source, **kwargs)
+                           for source in sources])
+        elif repo_type == 'git':
+            retval.extend([GitSource(source, **kwargs)
+                           for source in sources])
+        else:
+            raise AssertionError("Source type unknown: %s" % repo_type)
+    return retval