Permalink
Browse files

use lister keyword arguments for Repository constructor

  • Loading branch information...
1 parent 4dbccda commit 175eafaca81840492767e7e9ad445f9b4a6d2263 @stettberger stettberger committed Sep 27, 2010
Showing with 8 additions and 9 deletions.
  1. +8 −9 gmp/listers.py
View
@@ -15,7 +15,7 @@ class RepoLister (PolicyMixin):
listers = []
def __init__(self, cache = None, default_policy = "allow", scm = Git(), name = None,
- into = "~/"):
+ into = "~/", **kwargs):
PolicyMixin.__init__(self, default_policy)
RepoLister.listers.append(self)
@@ -31,6 +31,9 @@ def __init__(self, cache = None, default_policy = "allow", scm = Git(), name = N
# Default source control management is git, but can be changed by more specific listers
self.scm = scm
+ # Save all the other arguments, they will be pushed to repository constructors
+ self.kwargs = kwargs
+
self.name = name
def urls(self):
@@ -46,9 +49,9 @@ def create_repos(self):
repos = []
for url in self.urls():
if type(url) in [tuple, list]:
- repos.append( Repository(url[0], os.path.join(self.local_directory, url[1]), scm = self.scm))
+ repos.append( Repository(url[0], os.path.join(self.local_directory, url[1]), scm = self.scm, **self.kwargs))
else:
- repos.append( Repository(url, into = self.local_directory, scm = self.scm))
+ repos.append( Repository(url, into = self.local_directory, scm = self.scm, **self.kwargs))
return repos
def __iter__(self):
@@ -231,16 +234,12 @@ def __init__(self, svn_repo, postfix = "", **kwargs):
svn_repo: e.g svn+ssh://stettberger@barfoo.com/admin
postfix: e.g trunk, will be appended to the clone url"""
# This works just with git svn!
- kwargs['scm'] = GitSvn()
+ if not 'scm' in kwargs:
+ kwargs['scm'] = GitSvn()
RepoLister.__init__(self, **kwargs)
self.svn_repo = svn_repo
self.postfix = postfix
- def create_repos(self):
- return [Repository(url, os.path.join(self.local_directory, repo),
- scm = GitSvn()) for (repo, url) in self.urls()]
-
-
def get_list(self):
process = subprocess.Popen(["svn", "list", self.svn_repo],
stdout = subprocess.PIPE)

0 comments on commit 175eafa

Please sign in to comment.