Skip to content
This repository has been archived by the owner on Dec 27, 2017. It is now read-only.

bit3archive/vcs-synchronizer

Repository files navigation

Version ![Stable Build Status](http://img.shields.io/travis/contao-community-alliance/vcs-synchronizer/master.svg?style=flat-square&label=stable build) ![Upstream Build Status](http://img.shields.io/travis/contao-community-alliance/vcs-synchronizer/develop.svg?style=flat-square&label=dev build) License Downloads

VCS Synchronizers

This repository contains multiple synchronizers to synchronize multiple VCS repositories (of the same type).

Symmetric vs. Asymmetric synchronisation

Symmetric synchronisation means that each repository is compared and synchronized against each other. If a conflict is detected - two remotes have divergent branches - no repository of the concerned branch is synchronized.

Asymmetric synchronisation means that one - the primary - repository is compared and synchronized against all the others repositories. If a conflict is detected - one remote branch is ahead of the primary - the branch in the concerned repository is not synchronized.

Working repository

The synchronizers work on a local working repository. But they won't create them for you! This let you keep control of what happened.

Here is an example, how you could create the local working repository.

use ContaoCommunityAlliance\BuildSystem\Repository\GitRepository;

$path = tempnam(sys_get_temp_dir());
unlink($path);
mkdir($path);

$repository = new GitRepository($path);
$repository->init()->execute();
$repository->remote()->add('github', 'git@github.com:contao-community-alliance/vcs-synchronizer.git')->execute();
$repository->remote()->add('bitbucket', 'git@bitbucket.org:contao-community-alliance/vcs-synchronizer.git')->execute();

GIT Synchronizers

Symmetric branch synchronizer

CLI usage

./bin/git-branches-symmetric-sync -b github -b bitbucket /path/to/repository

PHP usage

use ContaoCommunityAlliance\BuildSystem\VcsSync\Synchronizer\GitSymmetricBranchSynchronizer;

$synchronizer = new GitSymmetricBranchSynchronizer(
    // the working repository
    $repository,
    // the remotes to synchronize
    ['github', 'bitbucket']
);
$synchronizer->setLogger($logger);
$synchronizer->sync();

Asymmetric branch synchronizer

CLI usage

./bin/git-branches-asymmetric-sync -b github -b bitbucket -p github /path/to/repository

PHP usage

use ContaoCommunityAlliance\BuildSystem\VcsSync\Synchronizer\GitAsymmetricBranchSynchronizer;

$synchronizer = new GitAsymmetricBranchSynchronizer(
    // the working repository
    $repository,
    // the remotes to synchronize
    ['github', 'bitbucket'],
    // the primary remote
    'github'
);
$synchronizer->setLogger($logger);
$synchronizer->sync();

Asymmetric tag synchronizer

CLI usage

./bin/git-tags-asymmetric-sync -b github -b bitbucket -p github /path/to/repository

PHP usage

use ContaoCommunityAlliance\BuildSystem\VcsSync\Synchronizer\GitAsymmetricTagSynchronizer;

$synchronizer = new GitAsymmetricTagSynchronizer(
    // the working repository
    $repository,
    // the remotes to synchronize
    ['github', 'bitbucket'],
    // the primary remote
    'github'
);
$synchronizer->setLogger($logger);
$synchronizer->sync();

About

Keep multiple VCS repositories in sync.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages