Skip to content

Instantly share code, notes, and snippets.

@bshaffer
Created August 1, 2011 23:46
Show Gist options
  • Save bshaffer/1119263 to your computer and use it in GitHub Desktop.
Save bshaffer/1119263 to your computer and use it in GitHub Desktop.
p4-sync
#!/usr/local/bin/php
<?php
if (count($argv) < 2) {
exit('p4-sync repository [branch or "trunk"]');
}
$repo = $argv[1];
$cmd = 'p4 sync //depot/%s/...';
if (count($argv) > 2) {
$path = $argv[2];
$type = $path == 'trunk' ? '' : 'branches/';
$repoPath = sprintf('%s/%s%s', $repo, $type, $path);
} else {
$repoPath = $repo;
}
passthru(sprintf($cmd, $repoPath));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment