contao-community-alliance/vcs-synchronizer

此包已被废弃且不再维护。作者建议使用 bit3/vcs-synchronizer 包代替。

保持多个VCS仓库同步。

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 同步器

此仓库包含多个同步器,用于同步多个相同类型的VCS仓库。

对称同步与不对称同步

对称同步意味着每个仓库都被比较并与其他仓库同步。如果检测到冲突(两个远程分支分叉),则不会同步相关分支的任何仓库。

不对称同步意味着一个(主仓库)与其他所有仓库进行比较和同步。如果检测到冲突(一个远程分支领先于主仓库),则不会同步相关仓库的分支。

工作仓库

同步器在本地 工作仓库 上工作。但它们不会为您创建它们!这可以让您控制发生了什么。

以下是一个创建本地 工作仓库 的示例。

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 同步器

对称分支同步器

CLI 使用

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

PHP 使用

use ContaoCommunityAlliance\BuildSystem\VcsSync\Synchronizer\GitSymmetricBranchSynchronizer;

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

不对称分支同步器

CLI 使用

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

PHP 使用

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

不对称标签同步器

CLI 使用

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

PHP 使用

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