Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15403773
D8753.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D8753.diff
View Options
diff --git a/src/workflow/ArcanistBaseWorkflow.php b/src/workflow/ArcanistBaseWorkflow.php
--- a/src/workflow/ArcanistBaseWorkflow.php
+++ b/src/workflow/ArcanistBaseWorkflow.php
@@ -44,7 +44,6 @@
const AUTO_COMMIT_TITLE = 'Automatic commit by arc';
private $commitMode = self::COMMIT_DISABLE;
- private $shouldAmend;
private $conduit;
private $conduitURI;
@@ -660,15 +659,17 @@
'--'.head($corrected))."\n");
$arg_key = head($corrected);
} else {
- throw new ArcanistUsageException(
- "Unknown argument '{$arg_key}'. Try 'arc help'.");
+ throw new ArcanistUsageException(pht(
+ "Unknown argument '%s'. Try 'arc help'.",
+ $arg_key));
}
}
} else if (!strncmp($arg, '-', 1)) {
$arg_key = substr($arg, 1);
if (empty($short_to_long_map[$arg_key])) {
- throw new ArcanistUsageException(
- "Unknown argument '{$arg_key}'. Try 'arc help'.");
+ throw new ArcanistUsageException(pht(
+ "Unknown argument '%s'. Try 'arc help'.",
+ $arg_key));
}
$arg_key = $short_to_long_map[$arg_key];
} else {
@@ -681,8 +682,9 @@
$dict[$arg_key] = true;
} else {
if ($ii == count($args) - 1) {
- throw new ArcanistUsageException(
- "Option '{$arg}' requires a parameter.");
+ throw new ArcanistUsageException(pht(
+ "Option '%s' requires a parameter.",
+ $arg));
}
if (!empty($options['repeat'])) {
$dict[$arg_key][] = $args[$ii + 1];
@@ -698,8 +700,9 @@
$dict[$more_key] = $more;
} else {
$example = reset($more);
- throw new ArcanistUsageException(
- "Unrecognized argument '{$example}'. Try 'arc help'.");
+ throw new ArcanistUsageException(pht(
+ "Unrecognized argument '%s'. Try 'arc help'.",
+ $example));
}
}
@@ -779,7 +782,7 @@
if ($this->stashed) {
$api = $this->getRepositoryAPI();
$api->unstashChanges();
- echo "Restored stashed changes to the working directory.\n";
+ echo pht('Restored stashed changes to the working directory.') . "\n";
}
}
@@ -820,15 +823,18 @@
$api->addToCommit($untracked);
$must_commit += array_flip($untracked);
} else if ($this->commitMode == self::COMMIT_DISABLE) {
- $prompt = "Do you want to continue without adding these files?";
- if (!phutil_console_confirm($prompt, $default_no = false)) {
- throw new ArcanistUserAbortException();
+ $prompt = $this->getAskForAddPrompt($untracked);
+ if (phutil_console_confirm($prompt)) {
+ throw new ArcanistUsageException(pht(
+ "Add these files and then run 'arc %s' again.",
+ $this->getWorkflowName()));
}
}
}
}
+ // NOTE: this is a subversion-only concept.
$incomplete = $api->getIncompleteChanges();
if ($incomplete) {
throw new ArcanistUsageException(
@@ -907,7 +913,7 @@
}
if ($must_commit) {
- if ($this->shouldAmend) {
+ if ($this->shouldAmend()) {
$commit = head($api->getLocalCommitInformation());
$api->amendCommit($commit['message']);
} else if ($api->supportsLocalCommits()) {
@@ -921,6 +927,10 @@
}
private function shouldAmend() {
+ return $this->calculateShouldAmend();
+ }
+
+ private function calculateShouldAmend() {
$api = $this->getRepositoryAPI();
if ($this->isHistoryImmutable() || !$api->supportsAmend()) {
@@ -982,13 +992,15 @@
if ($this->commitMode == self::COMMIT_DISABLE) {
return false;
}
- if ($this->shouldAmend === null) {
- $this->shouldAmend = $this->shouldAmend();
- }
if ($this->commitMode == self::COMMIT_ENABLE) {
return true;
}
- if ($this->shouldAmend) {
+ $prompt = $this->getAskForAddPrompt($files);
+ return phutil_console_confirm($prompt);
+ }
+
+ private function getAskForAddPrompt(array $files) {
+ if ($this->shouldAmend()) {
$prompt = pht(
'Do you want to amend these files to the commit?',
count($files));
@@ -997,7 +1009,7 @@
'Do you want to add these files to the commit?',
count($files));
}
- return phutil_console_confirm($prompt);
+ return $prompt;
}
protected function loadDiffBundleFromConduit(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 4:45 AM (2 d, 19 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7352074
Default Alt Text
D8753.diff (4 KB)
Attached To
Mode
D8753: Arcanist - normalize question about unstaged files across workflows (diff vs land)
Attached
Detach File
Event Timeline
Log In to Comment