def globalEmailConfig(self): self.cfg = repositorymap.RepositoryConfig( StringIO(''' [GLOBAL] email = foo@bar [repo] '''))
def test_initTakesStringOrObjects(self): # strings resolved to objects in setUp self.assertContextObjectsNotString() # now pass in objects appCfg = appconfig.AppConfig(self.appConfig) repCfg = repositorymap.RepositoryConfig(self.repConfig) self.ctx = context.Context(appCfg, repCfg) self.assertContextObjectsNotString()
def __init__(self, appConfig, repoConfig): # cannot be a mixin because shared base class collides if isinstance(appConfig, appconfig.AppConfig): self._ac = appConfig else: self._ac = appconfig.AppConfig(appConfig) if isinstance(repoConfig, repositorymap.RepositoryConfig): self._rm = repoConfig else: self._rm = repositorymap.RepositoryConfig(repoConfig) self.logs = log.LogCache(self) self.mails = mail.MailCache(self)
def createSynchronizers(self): self.synchronizers = [] addMail = None if self.cfg.getMailAll(): addMail = self.cfg.getEmail() for appCtxName in self.cfg.getApplicationContexts(): appCtx = self.cfg.getAppConfig(appCtxName) appCtx = appconfig.AppConfig(appCtx) for repoCtx in self.cfg.getRepoConfigs(appCtxName): repoCtx = repositorymap.RepositoryConfig(repoCtx) for repo in repoCtx.getRepositories(): repoCtx.addEmail(repo, addMail) self.synchronizers.append( Synchronize(appCtx, repoCtx, [repo]))
def setUp(self): os.environ['TESTCVSUSER'] = '******' self.fd, self.cf = tempfile.mkstemp(suffix='.bigitr') file(self.cf, 'r+').write(''' [GLOBAL] gitroot = git@host2 cvsroot = :pserver:${TESTCVSUSER}@server2:/path prehook.git = gitprehook arg cvsvar.V = default [Path/To/Git/repository] gitroot = git@host cvsroot = :pserver:${TESTCVSUSER}@servername:/path cvspath = Path/To/CVS/directory skeleton = /path/to/skeleton branchfrom = branchroot cvs.a1 = a1 cvs.a2 = a2 git.master = a2 git.a1 = a1 prefix.a2 = cvs-a2-prefix gitlog.a2 = --stat=500 cvsvar.V = override cvsvar.V2 = v2 merge.cvs-a2 = a2 master merge.cvs-a1 = a1 prehook.git.master = gitmasterprehook prehook.git.a1 = gita1prehook posthook.git.master = gitmasterposthook posthook.git = gitposthook posthook.cvs.cvs-a1 = cvsa1posthook email = foo@bar baz@blah [Path/To/Git/repo2] cvspath = Path/To/CVS/directory git.master = a2 prehook.cvs.cvs-a2 = cvsa2prehook "quoted arg" ''') self.cfg = repositorymap.RepositoryConfig(self.cf) otherfd, self.bad = tempfile.mkstemp(suffix='.bigitr') os.close(otherfd) file(self.bad, 'r+').write(''' [Path/To/Git/repository] [Another/Path/To/Git/repository] ''')