Example #1
0
def test_mirror():
    tmp = maketemp()
    main_path = os.path.join(tmp, "main.git")
    mirror_path = os.path.join(tmp, "mirror.git")
    repository.init(path=main_path, template=False)
    repository.init(path=mirror_path, template=False)
    repository.fast_import(
        git_dir=main_path,
        commit_msg="foo initial bar",
        committer="Mr. Unit Test <*****@*****.**>",
        files=[("foo", "bar\n")],
    )
    repository.mirror(main_path, mirror_path)
    export = os.path.join(tmp, "export")
    repository.export(git_dir=mirror_path, path=export)
    eq(os.listdir(export), ["foo"])
Example #2
0
def push_mirrors(config, git_dir):
    """
    Apply a push with the mirror option to all mirrors defined in gitosis.conf
    of the repository being updated.
    
    @param config: ConfiParser object loaded with gitosis.conf
    @param git_dir: Path the repository being updated. 
    """
    log = logging.getLogger('gitosis.mirror.push_mirrors')
    
    repository_dir = os.path.abspath(util.getRepositoryDir(config))
    git_dir = os.path.abspath(git_dir)
    git_name = get_git_name(repository_dir, git_dir)
    
    log.info('Updating %s\'s mirrors.' % git_name)
    
    for remote in get_mirrors(config, git_name):
        log.info('Updating %s.' % remote)
        repository.mirror(git_dir, remote)
Example #3
0
def push_mirrors(config, git_dir):
    """
    Apply a push with the mirror option to all mirrors defined in gitosis.conf
    of the repository being updated.
    
    @param config: ConfiParser object loaded with gitosis.conf
    @param git_dir: Path the repository being updated. 
    """
    log = logging.getLogger('gitosis.mirror.push_mirrors')
    
    repository_dir = os.path.abspath(util.getRepositoryDir(config))
    git_dir = os.path.abspath(git_dir)
    git_name = get_git_name(repository_dir, git_dir)
    
    log.info('Updating %s\'s mirrors.' % git_name)
    
    for remote in get_mirrors(config, git_name):
        log.info('Updating %s.' % remote)
        repository.mirror(git_dir, remote)
Example #4
0
def test_mirror():
    tmp = maketemp()
    main_path = os.path.join(tmp, 'main.git')
    mirror_path = os.path.join(tmp, 'mirror.git')
    repository.init(path=main_path, template=False)
    repository.init(path=mirror_path, template=False)
    repository.fast_import(
        git_dir=main_path,
        commit_msg='foo initial bar',
        committer='Mr. Unit Test <*****@*****.**>',
        files=[
            ('foo', 'bar\n'),
            ],
        )
    repository.mirror(main_path, mirror_path)
    export = os.path.join(tmp, 'export')
    repository.export(
        git_dir=mirror_path,
        path=export,
        )
    eq(os.listdir(export),
       ['foo'])