def test_update_branch(self):
        """Check that branch really gets updated"""
        # local has one commit
        commits = len([c for c in self.user_repo.iter_commits()])
        self.assertEqual(
            commits,
            1
        )

        # add a commit upstream
        self._commit(self.remote_repo, msg='Second commit')
        self.remote_repo.remote().push()
        commits = len([c for c in self.upstream_repo.iter_commits()])
        self.assertEqual(
            commits,
            2
        )

        # update the branch
        update_branch(self.user_repo, 'master')

        # local has two commits now as well
        commits = len([c for c in self.user_repo.iter_commits()])
        self.assertEqual(
            commits,
            2
        )
Beispiel #2
0
    def release_all(self):
        """Release all distributions"""
        logger.info('')
        msg = 'Release!'
        logger.info(msg)
        logger.info('-' * len(msg))
        for distribution_path in self.distributions:
            logger.info(DISTRIBUTION.format(distribution_path))
            dist_name = distribution_path.split('/')[-1]
            repo = Repo(distribution_path)

            release = ReleaseDistribution(repo.working_tree_dir, self.branch)
            new_version = release()
            self.versions[dist_name] = new_version

            self.buildout.set_version(dist_name, new_version)

            # update the local repository
            update_branch(repo, self.branch)
    def test_update_non_existing_branch(self):
        """Check that trying to update a non-existing branch does not fail"""
        with OutputCapture():
            result = update_branch(self.user_repo, 'non-existing-branch')

        self.assertFalse(result)