Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15378438
D12258.id29441.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D12258.id29441.diff
View Options
diff --git a/src/internationalization/ArcanistUSEnglishTranslation.php b/src/internationalization/ArcanistUSEnglishTranslation.php
--- a/src/internationalization/ArcanistUSEnglishTranslation.php
+++ b/src/internationalization/ArcanistUSEnglishTranslation.php
@@ -74,6 +74,16 @@
'%d assertion passed.',
'%d assertions passed.',
),
+
+ 'Do you want to add these %s change(s) to the current commit?' => array(
+ 'Do you want to add this change to the current commit?',
+ 'Do you want to add these changes to the current commit?',
+ ),
+
+ 'Ignore these %s untracked file(s)?' => array(
+ 'Ignore this untracked file?',
+ 'Ignore these untracked files?',
+ ),
);
}
diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php
--- a/src/workflow/ArcanistWorkflow.php
+++ b/src/workflow/ArcanistWorkflow.php
@@ -880,8 +880,43 @@
$untracked = array();
}
+ if ($untracked) {
+ echo pht(
+ "You have untracked files in this working copy.\n\n%s",
+ $working_copy_desc);
+
+ if ($api instanceof ArcanistGitAPI) {
+ $hint = pht(
+ '(To ignore these %s change(s), add them to ".git/info/exclude".)',
+ new PhutilNumber(count($untracked)));
+ } else if ($api instanceof ArcanistSubversionAPI) {
+ $hint = pht(
+ '(To ignore these %s change(s), add them to "svn:ignore".)',
+ new PhutilNumber(count($untracked)));
+ } else if ($api instanceof ArcanistMercurialAPI) {
+ $hint = pht(
+ '(To ignore these %s change(s), add them to ".hgignore".)',
+ new PhutilNumber(count($untracked)));
+ }
+
+ $untracked_list = " ".implode("\n ", $untracked);
+ echo pht(
+ " Untracked changes in working copy:\n %s\n%s",
+ $hint,
+ $untracked_list);
+
+ $prompt = pht(
+ 'Ignore these %s untracked file(s)?',
+ new PhutilNumber(count($untracked)));
+
+ if (!phutil_console_confirm($prompt)) {
+ throw new ArcanistUserAbortException();
+ }
+ }
+
+
$should_commit = false;
- if ($untracked || $unstaged || $uncommitted) {
+ if ($unstaged || $uncommitted) {
// NOTE: We're running this because it builds a cache and can take a
// perceptible amount of time to arrive at an answer, but we don't want
@@ -894,28 +929,6 @@
$lists = array();
- if ($untracked) {
- if ($api instanceof ArcanistGitAPI) {
- $hint = pht(
- '(To ignore these %s change(s), add them to ".git/info/exclude".)',
- new PhutilNumber(count($untracked)));
- } else if ($api instanceof ArcanistSubversionAPI) {
- $hint = pht(
- '(To ignore these %s change(s), add them to "svn:ignore".)',
- new PhutilNumber(count($untracked)));
- } else if ($api instanceof ArcanistMercurialAPI) {
- $hint = pht(
- '(To ignore these %s change(s), add them to ".hgignore".)',
- new PhutilNumber(count($untracked)));
- }
-
- $untracked_list = " ".implode("\n ", $untracked);
- $lists[] = pht(
- " Untracked changes in working copy:\n %s\n%s",
- $hint,
- $untracked_list);
- }
-
if ($unstaged) {
$unstaged_list = " ".implode("\n ", $unstaged);
$lists[] = pht(
@@ -932,12 +945,8 @@
echo implode("\n\n", $lists)."\n";
- $all_uncommitted = array_merge($untracked, $unstaged, $uncommitted);
+ $all_uncommitted = array_merge($unstaged, $uncommitted);
if ($this->askForAdd($all_uncommitted)) {
- if ($untracked) {
- $api->addToCommit($untracked);
- }
-
if ($unstaged) {
$api->addToCommit($unstaged);
}
@@ -952,20 +961,10 @@
$api->stashChanges();
$this->stashed = true;
} else {
- if ($untracked && !$unstaged && !$uncommitted) {
- // Give a tailored message if there are only untracked files,
- // because the advice to commit files does not make sense in
- // Subversion.
- throw new ArcanistUsageException(
- pht(
- 'You can not continue with untracked changes. Add them, '.
- 'discard them, or mark them as ignored before proceeding.'));
- } else {
- throw new ArcanistUsageException(
- pht(
- 'You can not continue with uncommitted changes. Commit '.
- 'or discard them before proceeding.'));
- }
+ throw new ArcanistUsageException(
+ pht(
+ 'You can not continue with uncommitted changes. Commit '.
+ 'or discard them before proceeding.'));
}
}
}
@@ -980,10 +979,6 @@
"# ".pht('Enter a commit message.')."\n#\n".
"# ".pht('Changes:')."\n#\n";
- foreach ($untracked as $untracked_path) {
- $template .= "# ".$untracked_path." (".pht('Added').")\n";
- }
-
$paths = array_merge($uncommitted, $unstaged);
$paths = array_unique($paths);
sort($paths);
@@ -1094,7 +1089,12 @@
}
private function getAskForAddPrompt(array $files) {
- if ($this->getShouldAmend()) {
+ $api = $this->getRepositoryAPI();
+ if ($api instanceof ArcanistSubversionAPI) {
+ $prompt = pht(
+ 'Do you want to add these %s change(s) to the current commit?',
+ new PhutilNumber(count($files)));
+ } else if ($this->getShouldAmend()) {
$prompt = pht(
'Do you want to amend these %s change(s) to the current commit?',
new PhutilNumber(count($files)));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 14, 2:30 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7497042
Default Alt Text
D12258.id29441.diff (5 KB)
Attached To
Mode
D12258: Prompt users to ignore or abort on untracked files
Attached
Detach File
Event Timeline
Log In to Comment