Fix some argument parsing stuff in reparse.php
				
					
				
			Summary: Currently, "reparse.php --message rXnnn" fails because $reparse_what is an array. Allow multiple named commits. Test Plan: $ ./scripts/repository/reparse.php --message rP9030fe8b0904b5291c69a22b0570a10013bba4b2 rP81946fc08d8a737b278255090e296ca92164d672 Running 'PhabricatorRepositoryGitCommitMessageParserWorker'... Running 'PhabricatorRepositoryGitCommitMessageParserWorker'... Done. Reviewers: nh, vrana, btrahan Reviewed By: nh CC: aran Differential Revision: https://secure.phabricator.com/D3362
This commit is contained in:
		| @@ -94,14 +94,10 @@ $force = $args->getArg('force'); | |||||||
| $force_local = $args->getArg('force-local'); | $force_local = $args->getArg('force-local'); | ||||||
| $min_date = $args->getArg('min-date'); | $min_date = $args->getArg('min-date'); | ||||||
|  |  | ||||||
| if (count($reparse_what) > 1 || !($all_from_repo xor count($reparse_what))) { | if (!$all_from_repo && !$reparse_what) { | ||||||
|   usage("Specify a commit or repository to reparse."); |   usage("Specify a commit or repository to reparse."); | ||||||
| } | } | ||||||
|  |  | ||||||
| if ($args->getArg('trace')) { |  | ||||||
|   PhutilServiceProfiler::installEchoListener(); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| if (!$reparse_message && !$reparse_change && !$reparse_herald && | if (!$reparse_message && !$reparse_change && !$reparse_herald && | ||||||
|     !$reparse_owners) { |     !$reparse_owners) { | ||||||
|   usage("Specify what information to reparse with --message, --change,  ". |   usage("Specify what information to reparse with --message, --change,  ". | ||||||
| @@ -146,8 +142,10 @@ if ($all_from_repo) { | |||||||
|   } |   } | ||||||
|   $callsign = $repository->getCallsign(); |   $callsign = $repository->getCallsign(); | ||||||
| } else { | } else { | ||||||
|  |   $commits = array(); | ||||||
|  |   foreach ($reparse_what as $identifier) { | ||||||
|     $matches = null; |     $matches = null; | ||||||
|   if (!preg_match('/r([A-Z]+)([a-z0-9]+)/', $reparse_what, $matches)) { |     if (!preg_match('/r([A-Z]+)([a-z0-9]+)/', $identifier, $matches)) { | ||||||
|       throw new Exception("Can't parse commit identifier!"); |       throw new Exception("Can't parse commit identifier!"); | ||||||
|     } |     } | ||||||
|     $callsign = $matches[1]; |     $callsign = $matches[1]; | ||||||
| @@ -164,11 +162,12 @@ if ($all_from_repo) { | |||||||
|       $commit_identifier); |       $commit_identifier); | ||||||
|     if (!$commit) { |     if (!$commit) { | ||||||
|       throw new Exception( |       throw new Exception( | ||||||
|       "No matching commit '{$commit_identifier}' in repository '{$callsign}'. ". |         "No matching commit '{$commit_identifier}' in repository ". | ||||||
|       "(For git and mercurial repositories, you must specify the entire ". |         "'{$callsign}'. (For git and mercurial repositories, you must specify ". | ||||||
|       "commit hash.)"); |         "the entire commit hash.)"); | ||||||
|  |     } | ||||||
|  |     $commits[] = $commit; | ||||||
|   } |   } | ||||||
|   $commits = array($commit); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| if ($all_from_repo && !$force_local) { | if ($all_from_repo && !$force_local) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 epriestley
					epriestley