contao-community-alliance / vcs-synchronizer
Keep multiple VCS repositories in sync.
Requires
- php: >=5.4
- contao-community-alliance/build-system-repository-git: ~1.0
- monolog/monolog: ~1.0
- symfony/console: ~2.3
- symfony/event-dispatcher: ~2.3
- symfony/monolog-bridge: ~2.3
Requires (Dev)
- contao-community-alliance/build-system: ~1.0
- contao-community-alliance/coding-standard: ~1.0
- phploc/phploc: ~2.0
- phpmd/phpmd: ~2.0
- phpunit/phpunit: 3.7.*
- sebastian/phpcpd: ~2.0
- squizlabs/php_codesniffer: ~1.0
- symfony/filesystem: ~2.5
- symfony/process: ~2.5
This package is not auto-updated.
Last update: 2019-02-20 18:12:32 UTC
README
![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)
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();