Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15400053
D14317.id34563.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D14317.id34563.diff
View Options
diff --git a/src/workflow/ArcanistUpgradeWorkflow.php b/src/workflow/ArcanistUpgradeWorkflow.php
--- a/src/workflow/ArcanistUpgradeWorkflow.php
+++ b/src/workflow/ArcanistUpgradeWorkflow.php
@@ -53,7 +53,27 @@
$this->setRepositoryAPI($repository);
- $this->requireCleanWorkingCopy();
+ // NOTE: Don't use requireCleanWorkingCopy() here because it tries to
+ // amend changes and generally move the workflow forward. We just want to
+ // abort if there are local changes and make the user sort things out.
+ $uncommitted = $repository->getUncommittedStatus();
+ if ($uncommitted) {
+ $message = pht(
+ 'You have uncommitted changes in the working copy for this '.
+ 'library:');
+
+ $list = id(new PhutilConsoleList())
+ ->setWrap(false)
+ ->addItems(array_keys($uncommitted));
+
+ id(new PhutilConsoleBlock())
+ ->addParagraph($message)
+ ->addList($list)
+ ->draw();
+
+ throw new ArcanistUsageException(
+ pht('`arc upgrade` can only upgrade clean working copies.'));
+ }
$branch_name = $repository->getBranchName();
if ($branch_name != 'master' && $branch_name != 'stable') {
@@ -71,10 +91,13 @@
}
chdir($root);
+
try {
- phutil_passthru('git pull --rebase');
+ execx('git pull --rebase');
} catch (Exception $ex) {
- phutil_passthru('git rebase --abort');
+ // If we failed, try to go back to the old state, then throw the
+ // original exception.
+ exec_manual('git rebase --abort');
throw $ex;
}
}
diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php
--- a/src/workflow/ArcanistWorkflow.php
+++ b/src/workflow/ArcanistWorkflow.php
@@ -1067,6 +1067,15 @@
}
}
+ public function setReadOnly($read_only) {
+ $this->readOnly = $read_only;
+ return $this;
+ }
+
+ public function getReadOnly() {
+ return $this->readOnly;
+ }
+
private function getShouldAmend() {
if ($this->shouldAmend === null) {
$this->shouldAmend = $this->calculateShouldAmend();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 18, 9:22 AM (4 d, 2 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7709591
Default Alt Text
D14317.id34563.diff (2 KB)
Attached To
Mode
D14317: Improve two error handling behaviors in `arc upgrade`
Attached
Detach File
Event Timeline
Log In to Comment