Created
March 31, 2010 02:43
-
-
Save co3k/349871 to your computer and use it in GitHub Desktop.
定期的に git-svn rebase して push するやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'VersionControl/Git.php'; | |
$git = new VersionControl_Git('/path/to/OpenPNE2-git-mirror'); | |
$git->setGitCommandPath('/path/to/git'); | |
$branches = $git->getBranches(); | |
foreach ($branches as $branch) | |
{ | |
$git->checkout($branch); | |
$git->getCommand('svn rebase')->execute(); | |
$git->getCommand('push') | |
->addArgument('origin') | |
->addArgument($branch) | |
->execute(); | |
} | |
$tags = $git->getTags(); | |
$remote_branches = $git->getRemoteBranches('tags'); | |
foreach ($remote_branches as $remote_branch) | |
{ | |
if (false !== strpos($remote_branch, '@')) | |
{ | |
continue; | |
} | |
if (isset($tags[$remote_branch])) | |
{ | |
continue; | |
} | |
$git->checkout('tags/'.$remote_branch); | |
$git->getCommand('tag') | |
->addArgument($remote_branch) | |
->execute(); | |
} | |
$git->getCommand('push') | |
->addArgument('origin') | |
->setOption('tags') | |
->execute(); | |
$git->checkout('master'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment