def test_push_mirrors(): tmp = maketemp() foo_path = os.path.join(tmp, 'foo.git') bar_path = os.path.join(tmp, 'bar.git') baz_path = os.path.join(tmp, 'baz.git') repository.init(path=foo_path, template=False) repository.init(path=bar_path, template=False) repository.init(path=baz_path, template=False) repository.fast_import( git_dir=foo_path, commit_msg='foo initial bar', committer='Mr. Unit Test <*****@*****.**>', files=[ ('foo', 'bar\n'), ], ) cfg = get_config() cfg.set('repo foo', 'mirrors', ' '.join([bar_path,baz_path])) mirror.push_mirrors(cfg, foo_path) export_bar = os.path.join(tmp, 'export_bar') export_baz = os.path.join(tmp, 'export_baz') repository.export( git_dir=bar_path, path=export_bar, ) repository.export( git_dir=baz_path, path=export_baz, ) eq(os.listdir(export_bar), ['foo']) eq(os.listdir(export_baz), ['foo'])
def update_mirrors(cfg, git_dir): mirror.push_mirrors(cfg, git_dir)