mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-16 09:41:06 +01:00
(stable) Promote 2018 Week 14
This commit is contained in:
commit
6185c89117
2 changed files with 44 additions and 67 deletions
|
@ -966,22 +966,6 @@ EOTEXT
|
||||||
throw new Exception(pht('Repository API is not supported.'));
|
throw new Exception(pht('Repository API is not supported.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($changes) > 250) {
|
|
||||||
$message = pht(
|
|
||||||
'This diff has a very large number of changes (%s). Differential '.
|
|
||||||
'works best for changes which will receive detailed human review, '.
|
|
||||||
'and not as well for large automated changes or bulk checkins. '.
|
|
||||||
'See %s for information about reviewing big checkins. Continue anyway?',
|
|
||||||
phutil_count($changes),
|
|
||||||
'https://secure.phabricator.com/book/phabricator/article/'.
|
|
||||||
'differential_large_changes/');
|
|
||||||
|
|
||||||
if (!phutil_console_confirm($message)) {
|
|
||||||
throw new ArcanistUsageException(
|
|
||||||
pht('Aborted generation of gigantic diff.'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$limit = 1024 * 1024 * 4;
|
$limit = 1024 * 1024 * 4;
|
||||||
foreach ($changes as $change) {
|
foreach ($changes as $change) {
|
||||||
$size = 0;
|
$size = 0;
|
||||||
|
|
|
@ -115,66 +115,59 @@ EOTEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function didParseArguments() {
|
protected function didParseArguments() {
|
||||||
$source = null;
|
$arguments = array(
|
||||||
$requested = 0;
|
'revision' => self::SOURCE_REVISION,
|
||||||
if ($this->getArgument('revision')) {
|
'diff' => self::SOURCE_DIFF,
|
||||||
$source = self::SOURCE_REVISION;
|
'arcbundle' => self::SOURCE_BUNDLE,
|
||||||
$requested++;
|
'patch' => self::SOURCE_PATCH,
|
||||||
}
|
'name' => self::SOURCE_REVISION,
|
||||||
if ($this->getArgument('diff')) {
|
);
|
||||||
$source = self::SOURCE_DIFF;
|
|
||||||
$requested++;
|
$sources = array();
|
||||||
}
|
foreach ($arguments as $key => $source_type) {
|
||||||
if ($this->getArgument('arcbundle')) {
|
$value = $this->getArgument($key);
|
||||||
$source = self::SOURCE_BUNDLE;
|
if (!$value) {
|
||||||
$requested++;
|
continue;
|
||||||
}
|
|
||||||
if ($this->getArgument('patch')) {
|
|
||||||
$source = self::SOURCE_PATCH;
|
|
||||||
$requested++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$use_revision_id = null;
|
switch ($key) {
|
||||||
if ($this->getArgument('name')) {
|
case 'revision':
|
||||||
$namev = $this->getArgument('name');
|
$value = $this->normalizeRevisionID($value);
|
||||||
if (count($namev) > 1) {
|
break;
|
||||||
|
case 'name':
|
||||||
|
if (count($value) > 1) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
pht('Specify at most one revision name.'));
|
pht('Specify at most one revision name.'));
|
||||||
}
|
}
|
||||||
$source = self::SOURCE_REVISION;
|
$value = $this->normalizeRevisionID(head($value));
|
||||||
$requested++;
|
break;
|
||||||
|
|
||||||
$use_revision_id = $this->normalizeRevisionID(head($namev));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($requested === 0) {
|
$sources[] = array(
|
||||||
throw new ArcanistUsageException(
|
$source_type,
|
||||||
pht(
|
$value,
|
||||||
"Specify one of '%s', '%s' (to select the current changes attached ".
|
);
|
||||||
"to a Differential revision), '%s' (to select a specific, ".
|
|
||||||
"out-of-date diff or a diff which is not attached to a revision), ".
|
|
||||||
"'%s' or '%s' to choose a patch source.",
|
|
||||||
'D12345',
|
|
||||||
'--revision <revision_id>',
|
|
||||||
'--diff <diff_id>',
|
|
||||||
'--arcbundle <file>',
|
|
||||||
'--patch <file>'));
|
|
||||||
} else if ($requested > 1) {
|
|
||||||
throw new ArcanistUsageException(
|
|
||||||
pht(
|
|
||||||
"Options '%s', '%s', '%s', '%s' and '%s' are not compatible. ".
|
|
||||||
"Choose exactly one patch source.",
|
|
||||||
'D12345',
|
|
||||||
'--revision',
|
|
||||||
'--diff',
|
|
||||||
'--arcbundle',
|
|
||||||
'--patch'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->source = $source;
|
if (!$sources) {
|
||||||
$this->sourceParam = nonempty(
|
throw new ArcanistUsageException(
|
||||||
$use_revision_id,
|
pht(
|
||||||
$this->getArgument($source));
|
'You must specify changes to apply to the working copy with '.
|
||||||
|
'"D12345", "--revision", "--diff", "--arcbundle", or "--patch".'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($sources) > 1) {
|
||||||
|
throw new ArcanistUsageException(
|
||||||
|
pht(
|
||||||
|
'Options "D12345", "--revision", "--diff", "--arcbundle" and '.
|
||||||
|
'"--patch" are mutually exclusive. Choose exactly one patch '.
|
||||||
|
'source.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$source = head($sources);
|
||||||
|
|
||||||
|
$this->source = $source[0];
|
||||||
|
$this->sourceParam = $source[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function requiresConduit() {
|
public function requiresConduit() {
|
||||||
|
|
Loading…
Reference in a new issue