contao-community-alliance/vcs-synchronizer

This package is abandoned and no longer maintained. The author suggests using the bit3/vcs-synchronizer package instead.

Keep multiple VCS repositories in sync.

dev-develop / 1.0.x-dev 2014-11-11 16:30 UTC

This package is not auto-updated.

Last update: 2019-02-20 18:12:32 UTC


README

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();