コード例 #1
0
ファイル: bzr_test.py プロジェクト: tewhalen/powerline-shell
    def setUp(self):
        self.powerline = mock.MagicMock()

        self.dirname = tempfile.mkdtemp()
        sh.cd(self.dirname)
        sh.bzr("init-repo", ".")
        sh.mkdir("trunk")
        sh.cd("trunk")
        sh.bzr("init")

        self.segment = bzr.Segment(self.powerline)
コード例 #2
0
    def setUp(self):
        self.powerline = mock.MagicMock()

        self.dirname = tempfile.mkdtemp()
        sh.cd(self.dirname)
        sh.bzr("init-repo", ".")
        sh.mkdir("trunk")
        sh.cd("trunk")
        sh.bzr("init")

        self.segment = bzr.Segment(self.powerline)
コード例 #3
0
ファイル: bzr_test.py プロジェクト: beclamide/powerline
    def setUp(self):
        self.powerline = mock.MagicMock()
        self.powerline.segment_conf.side_effect = dict_side_effect_fn({
            ("vcs", "show_symbol"):
            False,
        })

        self.dirname = tempfile.mkdtemp()
        sh.cd(self.dirname)
        sh.bzr("init-repo", ".")
        sh.mkdir("trunk")
        sh.cd("trunk")
        sh.bzr("init")

        self.segment = bzr.Segment(self.powerline, {})
コード例 #4
0
ファイル: bzr_sync.py プロジェクト: 0atman/bzr-sync
def sync_git_to_bzr(
    project_name,
    github_user,
    repositories_dir,
    bzr_url):
    """
    Using the provided {repositories_dir},
    pull down the git project from github
    ([email protected]:{git_user}/{project_name}.git),
    export all commits to a bzr repository,
    and push to launchpad at lp:{project_name}.

    If the launchpad repo already exists, this will fail the first time
    because the history will be entirely different from the existing history.
    Therefore, after running this the first time and getting an error,
    `cd {project_name}-bzr/` and run `bzr push --overwrite`.

    From then on, every subsequent time you run this, for the same
    repository directory, it should work fine.
    """

    git_dir = join(repositories_dir, project_name + '-git')
    bzr_dir = join(repositories_dir, project_name + '-bzr')
    git_url = '[email protected]:{0}/{1}.git'.format(github_user, project_name)

    logger = ShLogger()

    # Clone the git repo, or pull if it exists
    if not isdir(git_dir):
        logger.update_for_command(
            "Cloning " + git_url,
            git.clone(git_url, git_dir)
        )
    else:
        logger.update_for_command(
            "Pulling {0} changes".format(project_name),
            git('-C', git_dir, 'pull')
        )

    # Always delete and recreate the bzr repo
    logger.update_for_command(
        "Removing bzr dir {0}".format(bzr_dir),
        rm(bzr_dir, r=True, f=True)
    )

    try:
        logger.update_for_command(
            "Creating BZR repo",
            bzr('init-repo', bzr_dir)
        )
    except ErrorReturnCode, sh_error:
        logger.update('init-repo returned error code {0}. Message: {1}'.format(
            str(sh_error.exit_code), sh_error.message
        ))
コード例 #5
0
ファイル: bzr_sync.py プロジェクト: 0atman/bzr-sync
    try:
        logger.update_for_command(
            "Creating BZR repo",
            bzr('init-repo', bzr_dir)
        )
    except ErrorReturnCode, sh_error:
        logger.update('init-repo returned error code {0}. Message: {1}'.format(
            str(sh_error.exit_code), sh_error.message
        ))

    # Update the BZR repo with commits from git
    logger.update_for_command(
        "Entering bzr repo",
        cd(bzr_dir)
    )

    logger.update_for_command(
        "Updating BZR repo",
        bzr(
            git('-C', git_dir, 'fast-export', M=True, all=True),
            'fast-import', '-'
        )
    )

    logger.update_for_command(
        "Pushing BZR changes",
        bzr.push(bzr_url, overwrite=True, directory="trunk")
    )

    return logger.log
コード例 #6
0
ファイル: bzr_test.py プロジェクト: beclamide/powerline
 def _checkout_new_branch(self, branch):
     sh.cd("..")
     sh.bzr("branch", "trunk", branch)
     sh.cd(branch)
コード例 #7
0
ファイル: bzr_test.py プロジェクト: beclamide/powerline
 def _add_and_commit(self, filename):
     sh.touch(filename)
     sh.bzr("add", filename)
     sh.bzr("commit", "-m", "add file " + filename)
コード例 #8
0
ファイル: bzr_test.py プロジェクト: tewhalen/powerline-shell
 def _checkout_new_branch(self, branch):
     sh.cd("..")
     sh.bzr("branch", "trunk", branch)
     sh.cd(branch)
コード例 #9
0
ファイル: bzr_test.py プロジェクト: tewhalen/powerline-shell
 def _add_and_commit(self, filename):
     sh.touch(filename)
     sh.bzr("add", filename)
     sh.bzr("commit", "-m", "add file " + filename)