示例#1
0
def main(reactor, *argv):
    config = Options()
    config.parseOptions(argv[1:])

    if config["branch"] is None:
        try:
            git.ensureGitRepository(reactor=reactor)
            config["branch"] = yield git.getCurrentSVNBranch(reactor=reactor)
        except git.NotAGitRepository:
            raise SystemExit("Must specify a branch to build or be in a git repository.")
        except git.NotASVNRevision:
            raise SystemExit("Current commit hasn't been pushed to svn.")

    reason = "%s: %s" % (pwd.getpwuid(os.getuid())[0], config["comments"])

    print "Forcing..."
    url = yield buildbot.forceBuild(config["branch"], reason, config["tests"], reactor=reactor)
    print "Forced."
    print "See %s for results" % (url,)
示例#2
0
def main(reactor, *argv):
    config = Options()
    config.parseOptions(argv[1:])

    if config['branch'] is None:
        try:
            git.ensureGitRepository(reactor=reactor)
            config['branch'] = yield git.getCurrentSVNBranch(reactor=reactor)
        except git.NotAGitRepository:
            raise SystemExit("Must specify a branch to build or be in a git repository.")
        except git.NotASVNRevision:
            raise SystemExit("Current commit hasn't been pushed to svn.")


    reason = '%s: %s' % (pwd.getpwuid(os.getuid())[0], config['comments'])

    print('Forcing...')
    url = yield buildbot.forceBuild(config['branch'], reason, config['tests'], reactor=reactor)
    print('Forced.')
    print('See %s for results' % (url,))
示例#3
0
    def test_isGitRepository(self):
        """
        When called from a git repository, L{git.ensureGitRepository} returns
        a deferred that doesn't errback.
        """
        basedir = FilePath(self.mktemp())
        basedir.createDirectory()
        basedir.child('.git').setContent('blah-blah-blah')
        gitRepo = basedir.child('git-repo')

        # Create a git repository
        d = getProcessValue('git', ('init', gitRepo.path))

        d.addCallback(lambda _: git.ensureGitRepository(gitRepo.path))
        return d
示例#4
0
    def test_isGitRepository(self):
        """
        When called from a git repository, L{git.ensureGitRepository} returns
        a deferred that doesn't errback.
        """
        basedir = FilePath(self.mktemp())
        basedir.createDirectory()
        basedir.child('.git').setContent('blah-blah-blah')
        gitRepo = basedir.child('git-repo')

        # Create a git repository
        d = getProcessValue('git', ('init', gitRepo.path))

        d.addCallback(lambda _: git.ensureGitRepository(gitRepo.path))
        return d
示例#5
0
    def test_raiseNotAGitRepository(self):
        """
        When called from a directory that isn't part of a git repository,
        L{git.ensureGitRepository} raises L{git.NotAGitRepository}.

        Since trial is usually run in a subdirectory of the current
        repository, we need to convince C{git rev-parse} that we aren't
        in a repository. It turns out that if there is a file L{.git}
        in the directory that isn't of the format C{gitdir: path/to/git/dir}
        it considers that directory not part of a git repository.
        """
        basedir = FilePath(self.mktemp())
        basedir.createDirectory()
        basedir.child('.git').setContent('blah-blah-blah')
        return self.assertFailure(git.ensureGitRepository(basedir.path), git.NotAGitRepository)
示例#6
0
    def test_raiseNotAGitRepository(self):
        """
        When called from a directory that isn't part of a git repository,
        L{git.ensureGitRepository} raises L{git.NotAGitRepository}.

        Since trial is usually run in a subdirectory of the current
        repository, we need to convince C{git rev-parse} that we aren't
        in a repository. It turns out that if there is a file L{.git}
        in the directory that isn't of the format C{gitdir: path/to/git/dir}
        it considers that directory not part of a git repository.
        """
        basedir = FilePath(self.mktemp())
        basedir.createDirectory()
        basedir.child('.git').setContent('blah-blah-blah')
        return self.assertFailure(git.ensureGitRepository(basedir.path),
                                  git.NotAGitRepository)