Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$root = dirname(dirname(dirname(__FILE__)));
|
|
|
|
require_once $root.'/scripts/__init_script__.php';
|
|
|
|
|
2012-08-14 04:35:30 +02:00
|
|
|
$args = new PhutilArgumentParser($argv);
|
|
|
|
$args->setSynopsis(<<<EOHELP
|
|
|
|
**reparse.php** __what__ __which_parts__ [--trace] [--force]
|
|
|
|
|
|
|
|
Rerun the Diffusion parser on specific commits and repositories. Mostly
|
|
|
|
useful for debugging changes to Diffusion.
|
2013-04-05 16:35:35 +02:00
|
|
|
|
|
|
|
e.g. enqueue reparse owners in the TEST repo for all commits:
|
|
|
|
./reparse.php --all TEST --owners
|
|
|
|
|
|
|
|
e.g. do same but exclude before yesterday (local time):
|
|
|
|
./reparse.php --all TEST --owners --min-date yesterday
|
|
|
|
./reparse.php --all TEST --owners --min-date "today -1 day"
|
|
|
|
|
|
|
|
e.g. do same but exclude before 03/31/2013 (local time):
|
|
|
|
./reparse.php --all TEST --owners --min-date "03/31/2013"
|
2012-08-14 04:35:30 +02:00
|
|
|
EOHELP
|
|
|
|
);
|
|
|
|
|
2013-04-05 16:35:35 +02:00
|
|
|
$min_date_usage_examples =
|
|
|
|
"Valid examples:\n".
|
|
|
|
" 'today', 'today 2pm', '-1 hour', '-2 hours', '-24 hours',\n".
|
|
|
|
" 'yesterday', 'today -1 day', 'yesterday 2pm', '2pm -1 day',\n".
|
|
|
|
" 'last Monday', 'last Monday 14:00', 'last Monday 2pm',\n".
|
|
|
|
" '31 March 2013', '31 Mar', '03/31', '03/31/2013',\n".
|
|
|
|
"See __http://www.php.net/manual/en/datetime.formats.php__ for more.\n";
|
|
|
|
|
2012-08-14 04:35:30 +02:00
|
|
|
$args->parseStandardArguments();
|
|
|
|
$args->parse(
|
|
|
|
array(
|
|
|
|
// what
|
|
|
|
array(
|
|
|
|
'name' => 'revision',
|
|
|
|
'wildcard' => true,
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => 'all',
|
|
|
|
'param' => 'callsign or phid',
|
|
|
|
'help' => 'Reparse all commits in the specified repository. This '.
|
|
|
|
'mode queues parsers into the task queue; you must run '.
|
|
|
|
'taskmasters to actually do the parses. Use with '.
|
|
|
|
'__--force-local__ to run the tasks locally instead of '.
|
|
|
|
'with taskmasters.',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => 'min-date',
|
|
|
|
'param' => 'date',
|
2013-04-05 16:35:35 +02:00
|
|
|
'help' => 'Must be used with __--all__, this will exclude commits '.
|
|
|
|
'which are earlier than __date__.'.
|
|
|
|
"\n".$min_date_usage_examples,
|
2012-08-14 04:35:30 +02:00
|
|
|
),
|
|
|
|
// which parts
|
|
|
|
array(
|
|
|
|
'name' => 'message',
|
|
|
|
'help' => 'Reparse commit messages.',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => 'change',
|
|
|
|
'help' => 'Reparse changes.',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => 'herald',
|
|
|
|
'help' => 'Reevaluate Herald rules (may send huge amounts of email!)',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => 'owners',
|
|
|
|
'help' => 'Reevaluate related commits for owners packages (may '.
|
|
|
|
'delete existing relationship entries between your '.
|
|
|
|
'package and some old commits!)',
|
|
|
|
),
|
2012-12-17 22:43:26 +01:00
|
|
|
array(
|
|
|
|
'name' => 'harbormaster',
|
|
|
|
'help' => 'EXPERIMENTAL. Execute Harbormaster.',
|
|
|
|
),
|
2012-08-14 04:35:30 +02:00
|
|
|
// misc options
|
|
|
|
array(
|
|
|
|
'name' => 'force',
|
|
|
|
'short' => 'f',
|
|
|
|
'help' => 'Act noninteractively, without prompting.',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => 'force-local',
|
|
|
|
'help' => 'Only used with __--all__, use this to run the tasks '.
|
|
|
|
'locally instead of deferring them to taskmaster daemons.',
|
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$all_from_repo = $args->getArg('all');
|
|
|
|
$reparse_message = $args->getArg('message');
|
|
|
|
$reparse_change = $args->getArg('change');
|
|
|
|
$reparse_herald = $args->getArg('herald');
|
|
|
|
$reparse_owners = $args->getArg('owners');
|
2012-12-17 22:43:26 +01:00
|
|
|
$reparse_harbormaster = $args->getArg('harbormaster');
|
2012-08-14 04:35:30 +02:00
|
|
|
$reparse_what = $args->getArg('revision');
|
|
|
|
$force = $args->getArg('force');
|
|
|
|
$force_local = $args->getArg('force-local');
|
|
|
|
$min_date = $args->getArg('min-date');
|
|
|
|
|
2012-08-22 23:03:04 +02:00
|
|
|
if (!$all_from_repo && !$reparse_what) {
|
2012-08-14 04:35:30 +02:00
|
|
|
usage("Specify a commit or repository to reparse.");
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
}
|
|
|
|
|
2013-04-05 16:35:35 +02:00
|
|
|
if ($all_from_repo && $reparse_what) {
|
|
|
|
$commits = implode(', ', $reparse_what);
|
|
|
|
usage(
|
|
|
|
"Specify a commit or repository to reparse, not both:\n".
|
|
|
|
"All from repo: ".$all_from_repo."\n".
|
|
|
|
"Commit(s) to reparse: ".$commits);
|
|
|
|
}
|
|
|
|
|
Add Related Commits for Owners
Summary:
For each commit, find the affected packages, and provide a way to
search by package.
Test Plan:
create commits that touch and don't touch two packages, and verify
that they display correctly in all the UI pages.
Reviewers: epriestley, blair, nh, tuomaspelkonen
Reviewed By: epriestley
CC: benmathews, aran, epriestley, btrahan, jungejason, mpodobnik, prithvi
Maniphest Tasks: T83
Differential Revision: 1208
2011-12-14 09:53:25 +01:00
|
|
|
if (!$reparse_message && !$reparse_change && !$reparse_herald &&
|
2012-12-17 22:43:26 +01:00
|
|
|
!$reparse_owners && !$reparse_harbormaster) {
|
Add Related Commits for Owners
Summary:
For each commit, find the affected packages, and provide a way to
search by package.
Test Plan:
create commits that touch and don't touch two packages, and verify
that they display correctly in all the UI pages.
Reviewers: epriestley, blair, nh, tuomaspelkonen
Reviewed By: epriestley
CC: benmathews, aran, epriestley, btrahan, jungejason, mpodobnik, prithvi
Maniphest Tasks: T83
Differential Revision: 1208
2011-12-14 09:53:25 +01:00
|
|
|
usage("Specify what information to reparse with --message, --change, ".
|
2012-12-17 22:43:26 +01:00
|
|
|
"--herald, --harbormaster, and/or --owners");
|
Add Related Commits for Owners
Summary:
For each commit, find the affected packages, and provide a way to
search by package.
Test Plan:
create commits that touch and don't touch two packages, and verify
that they display correctly in all the UI pages.
Reviewers: epriestley, blair, nh, tuomaspelkonen
Reviewed By: epriestley
CC: benmathews, aran, epriestley, btrahan, jungejason, mpodobnik, prithvi
Maniphest Tasks: T83
Differential Revision: 1208
2011-12-14 09:53:25 +01:00
|
|
|
}
|
2013-04-05 16:35:35 +02:00
|
|
|
|
|
|
|
$min_timestamp = false;
|
|
|
|
if ($min_date) {
|
|
|
|
$min_timestamp = strtotime($min_date);
|
|
|
|
|
|
|
|
if (!$all_from_repo) {
|
|
|
|
usage(
|
|
|
|
"You must use --all if you specify --min-date\n".
|
|
|
|
"e.g.\n".
|
|
|
|
" ./reparse.php --all TEST --owners --min-date yesterday");
|
|
|
|
}
|
|
|
|
|
|
|
|
// previous to PHP 5.1.0 you would compare with -1, instead of false
|
|
|
|
if (false === $min_timestamp) {
|
|
|
|
usage(
|
|
|
|
"Supplied --min-date is not valid\n".
|
|
|
|
"Supplied value: '".$min_date."'\n".
|
|
|
|
$min_date_usage_examples);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add Related Commits for Owners
Summary:
For each commit, find the affected packages, and provide a way to
search by package.
Test Plan:
create commits that touch and don't touch two packages, and verify
that they display correctly in all the UI pages.
Reviewers: epriestley, blair, nh, tuomaspelkonen
Reviewed By: epriestley
CC: benmathews, aran, epriestley, btrahan, jungejason, mpodobnik, prithvi
Maniphest Tasks: T83
Differential Revision: 1208
2011-12-14 09:53:25 +01:00
|
|
|
if ($reparse_owners && !$force) {
|
|
|
|
echo phutil_console_wrap(
|
|
|
|
"You are about to recreate the relationship entries between the commits ".
|
|
|
|
"and the packages they touch. This might delete some existing ".
|
|
|
|
"relationship entries for some old commits.");
|
|
|
|
|
|
|
|
if (!phutil_console_confirm('Are you ready to continue?')) {
|
|
|
|
echo "Cancelled.\n";
|
|
|
|
exit(1);
|
|
|
|
}
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$commits = array();
|
2012-08-14 04:35:30 +02:00
|
|
|
if ($all_from_repo) {
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
$repository = id(new PhabricatorRepository())->loadOneWhere(
|
|
|
|
'callsign = %s OR phid = %s',
|
2012-08-14 04:35:30 +02:00
|
|
|
$all_from_repo,
|
|
|
|
$all_from_repo);
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
if (!$repository) {
|
2012-08-14 04:35:30 +02:00
|
|
|
throw new Exception("Unknown repository {$all_from_repo}!");
|
|
|
|
}
|
|
|
|
$constraint = '';
|
2013-04-05 16:35:35 +02:00
|
|
|
if ($min_timestamp) {
|
|
|
|
echo "Excluding entries before UNIX timestamp: ".$min_timestamp."\n";
|
2012-08-14 04:35:30 +02:00
|
|
|
$table = new PhabricatorRepositoryCommit();
|
|
|
|
$conn_r = $table->establishConnection('r');
|
|
|
|
$constraint = qsprintf(
|
|
|
|
$conn_r,
|
2013-04-05 16:35:35 +02:00
|
|
|
'AND epoch >= %d',
|
|
|
|
$min_timestamp);
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
}
|
|
|
|
$commits = id(new PhabricatorRepositoryCommit())->loadAllWhere(
|
2012-08-14 04:35:30 +02:00
|
|
|
'repositoryID = %d %Q',
|
|
|
|
$repository->getID(),
|
|
|
|
$constraint);
|
2012-12-06 20:11:05 +01:00
|
|
|
$callsign = $repository->getCallsign();
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
if (!$commits) {
|
2012-12-06 20:11:05 +01:00
|
|
|
echo "No commits have been discovered in {$callsign} repository!\n";
|
|
|
|
exit;
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
}
|
|
|
|
} else {
|
2012-08-22 23:03:04 +02:00
|
|
|
$commits = array();
|
|
|
|
foreach ($reparse_what as $identifier) {
|
|
|
|
$matches = null;
|
|
|
|
if (!preg_match('/r([A-Z]+)([a-z0-9]+)/', $identifier, $matches)) {
|
|
|
|
throw new Exception("Can't parse commit identifier!");
|
|
|
|
}
|
|
|
|
$callsign = $matches[1];
|
|
|
|
$commit_identifier = $matches[2];
|
|
|
|
$repository = id(new PhabricatorRepository())->loadOneWhere(
|
|
|
|
'callsign = %s',
|
|
|
|
$callsign);
|
|
|
|
if (!$repository) {
|
|
|
|
throw new Exception("No repository with callsign '{$callsign}'!");
|
|
|
|
}
|
|
|
|
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
|
|
|
|
'repositoryID = %d AND commitIdentifier = %s',
|
|
|
|
$repository->getID(),
|
|
|
|
$commit_identifier);
|
|
|
|
if (!$commit) {
|
|
|
|
throw new Exception(
|
|
|
|
"No matching commit '{$commit_identifier}' in repository ".
|
|
|
|
"'{$callsign}'. (For git and mercurial repositories, you must specify ".
|
|
|
|
"the entire commit hash.)");
|
|
|
|
}
|
|
|
|
$commits[] = $commit;
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-14 04:35:30 +02:00
|
|
|
if ($all_from_repo && !$force_local) {
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
echo phutil_console_format(
|
|
|
|
'**NOTE**: This script will queue tasks to reparse the data. Once the '.
|
|
|
|
'tasks have been queued, you need to run Taskmaster daemons to execute '.
|
|
|
|
'them.');
|
|
|
|
echo "\n\n";
|
|
|
|
echo "QUEUEING TASKS (".number_format(count($commits))." Commits):\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$tasks = array();
|
|
|
|
foreach ($commits as $commit) {
|
|
|
|
$classes = array();
|
|
|
|
switch ($repository->getVersionControlSystem()) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
|
|
|
if ($reparse_message) {
|
|
|
|
$classes[] = 'PhabricatorRepositoryGitCommitMessageParserWorker';
|
|
|
|
}
|
|
|
|
if ($reparse_change) {
|
|
|
|
$classes[] = 'PhabricatorRepositoryGitCommitChangeParserWorker';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
|
|
|
if ($reparse_message) {
|
|
|
|
$classes[] = 'PhabricatorRepositoryMercurialCommitMessageParserWorker';
|
|
|
|
}
|
|
|
|
if ($reparse_change) {
|
|
|
|
$classes[] = 'PhabricatorRepositoryMercurialCommitChangeParserWorker';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
if ($reparse_message) {
|
|
|
|
$classes[] = 'PhabricatorRepositorySvnCommitMessageParserWorker';
|
|
|
|
}
|
|
|
|
if ($reparse_change) {
|
|
|
|
$classes[] = 'PhabricatorRepositorySvnCommitChangeParserWorker';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($reparse_herald) {
|
|
|
|
$classes[] = 'PhabricatorRepositoryCommitHeraldWorker';
|
|
|
|
}
|
|
|
|
|
Add Related Commits for Owners
Summary:
For each commit, find the affected packages, and provide a way to
search by package.
Test Plan:
create commits that touch and don't touch two packages, and verify
that they display correctly in all the UI pages.
Reviewers: epriestley, blair, nh, tuomaspelkonen
Reviewed By: epriestley
CC: benmathews, aran, epriestley, btrahan, jungejason, mpodobnik, prithvi
Maniphest Tasks: T83
Differential Revision: 1208
2011-12-14 09:53:25 +01:00
|
|
|
if ($reparse_owners) {
|
|
|
|
$classes[] = 'PhabricatorRepositoryCommitOwnersWorker';
|
|
|
|
}
|
|
|
|
|
2012-12-17 22:43:26 +01:00
|
|
|
if ($reparse_harbormaster) {
|
|
|
|
$classes[] = 'HarbormasterRunnerWorker';
|
|
|
|
}
|
|
|
|
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
$spec = array(
|
|
|
|
'commitID' => $commit->getID(),
|
|
|
|
'only' => true,
|
|
|
|
);
|
|
|
|
|
2012-08-14 04:35:30 +02:00
|
|
|
if ($all_from_repo && !$force_local) {
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
foreach ($classes as $class) {
|
2012-10-31 23:22:16 +01:00
|
|
|
PhabricatorWorker::scheduleTask($class, $spec);
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
|
|
|
|
$commit_name = 'r'.$callsign.$commit->getCommitIdentifier();
|
|
|
|
echo " Queued '{$class}' for commit '{$commit_name}'.\n";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
foreach ($classes as $class) {
|
|
|
|
$worker = newv($class, array($spec));
|
|
|
|
echo "Running '{$class}'...\n";
|
2012-12-17 22:43:26 +01:00
|
|
|
$worker->executeTask();
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "\nDone.\n";
|
|
|
|
|
|
|
|
function usage($message) {
|
2012-08-14 04:35:30 +02:00
|
|
|
echo phutil_console_format(
|
2013-04-05 16:35:35 +02:00
|
|
|
'**Usage Exception:** '.$message."\n".
|
|
|
|
"Use __--help__ to display full help\n");
|
Refactor repository reparse scripts to be more useful
Summary:
Splitting up D960 a bit, see that for context.
We currently have two scripts, "parse_one_commit.php" and
"reparse_all_commit_messages.php", but they're sort of silly and you can't do
certain things with them. Replace them with one script which is more flexible
and can do specific reparse steps on individual commits or entire repos.
I left the old scripts as stubs since I think there are some FB wiki docs and
stuff that mention them. I'll delete them in a month or whenever I remember or
something.
Test Plan: Ran "reparse.php" with various arguments, including vs-one-commit,
vs-repository, with --trace, and against different types of repos.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 964
2011-09-27 00:04:04 +02:00
|
|
|
exit(1);
|
|
|
|
}
|