Introduce "bin/repository" for repository management

Summary:
Nothing new or exciting here yet, just moving the random scripts/repositories/ things to bin/repository. Also add `repository list`.

(Console stuff comes from D2841.)

Test Plan: Ran `repository list`, `repository pull`, `repository discover`, `repository discover --verbose`, `repository help`.

Reviewers: jungejason, vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D2849
This commit is contained in:
epriestley
2012-06-25 12:35:37 -07:00
parent 37df05c7a5
commit 13d96e6377
9 changed files with 256 additions and 70 deletions

View File

@@ -17,38 +17,8 @@
* limitations under the License.
*/
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline('manually discover working copies');
$args->setSynopsis(<<<EOHELP
**discover.php** [__options__] __repository-callsign-or-phid ...__
Manually discover commits in working copies for the named repositories.
EOHELP
);
$args->parseStandardArguments();
$args->parse(
array(
array(
'name' => 'repositories',
'wildcard' => true,
),
));
$repo_names = $args->getArg('repositories');
if (!$repo_names) {
echo "Specify one or more repositories to pull, by callsign or PHID.\n";
exit(1);
}
$repos = PhabricatorRepository::loadAllByPHIDOrCallsign($repo_names);
foreach ($repos as $repo) {
$callsign = $repo->getCallsign();
echo "Discovering '{$callsign}'...\n";
$daemon = new PhabricatorRepositoryPullLocalDaemon(array());
$daemon->setVerbose(true);
$daemon->discoverRepository($repo);
}
echo "Done.\n";
echo
"This script has moved. All repository management is now performed through ".
"'bin/repository'. Use this command instead:\n\n".
" phabricator/ $ ./bin/repository discover ...\n";
exit(1);

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env php
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline('manage repositories');
$args->setSynopsis(<<<EOSYNOPSIS
**repository** __command__ [__options__]
Manage and debug Phabricator repository configuration, tracking,
discovery and import.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhabricatorRepositoryManagementPullWorkflow(),
new PhabricatorRepositoryManagementDiscoverWorkflow(),
new PhabricatorRepositoryManagementListWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$args->parseWorkflows($workflows);

View File

@@ -17,38 +17,8 @@
* limitations under the License.
*/
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline('manually pull working copies');
$args->setSynopsis(<<<EOHELP
**pull.php** [__options__] __repository-callsign-or-phid ...__
Manually pull/fetch working copies for the named repositories.
EOHELP
);
$args->parseStandardArguments();
$args->parse(
array(
array(
'name' => 'repositories',
'wildcard' => true,
),
));
$repo_names = $args->getArg('repositories');
if (!$repo_names) {
echo "Specify one or more repositories to pull, by callsign or PHID.\n";
exit(1);
}
$repos = PhabricatorRepository::loadAllByPHIDOrCallsign($repo_names);
foreach ($repos as $repo) {
$callsign = $repo->getCallsign();
echo "Pulling '{$callsign}'...\n";
$daemon = new PhabricatorRepositoryPullLocalDaemon(array());
$daemon->setVerbose(true);
$daemon->pullRepository($repo);
}
echo "Done.\n";
echo
"This script has moved. All repository management is now performed through ".
"'bin/repository'. Use this command instead:\n\n".
" phabricator/ $ ./bin/repository pull ...\n";
exit(1);