2017 © Pedro Peláez
 

library vcs-synchronizer

Keep multiple VCS repositories in sync.

image

contao-community-alliance/vcs-synchronizer

Keep multiple VCS repositories in sync.

  • Tuesday, November 11, 2014
  • by cca
  • Repository
  • 0 Watchers
  • 0 Stars
  • 2 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

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, (*1)

VCS Synchronizers

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

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., (*3)

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., (*4)

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., (*5)

Here is an example, how you could create the local working repository., (*6)

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, (*7)

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

PHP usage, (*8)

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, (*9)

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

PHP usage, (*10)

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, (*11)

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

PHP usage, (*12)

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

The Versions