1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00

Arcanist - allow amending revisions by other authors in the working copy

Summary: Fixes T4670. Give the user an option to abort but otherwise proceed.

Test Plan: arc patch D8685 (by epriestley); arc amend

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T4670

Differential Revision: https://secure.phabricator.com/D8716
This commit is contained in:
Bob Trahan 2014-04-08 11:58:50 -07:00
parent 0cff627d75
commit 2714395d98

View file

@ -94,7 +94,6 @@ EOTEXT
$in_working_copy = $repository_api->loadWorkingCopyDifferentialRevisions(
$this->getConduit(),
array(
'authors' => array($this->getUserPHID()),
'status' => 'status-any',
));
$in_working_copy = ipull($in_working_copy, null, 'id');
@ -113,6 +112,24 @@ EOTEXT
throw new ArcanistUsageException($message);
} else {
$revision_id = key($in_working_copy);
$revision = $in_working_copy[$revision_id];
if ($revision['authorPHID'] != $this->getUserPHID()) {
$other_author = $this->getConduit()->callMethodSynchronous(
'user.query',
array(
'phids' => array($revision['authorPHID']),
));
$other_author = ipull($other_author, 'userName', 'phid');
$other_author = $other_author[$revision['authorPHID']];
$rev_title = $revision['title'];
$ok = phutil_console_confirm(
"You are amending the revision 'D{$revision_id}: {$rev_title}' ".
"but you are not the author. Amend this revision by ".
"{$other_author}?");
if (!$ok) {
throw new ArcanistUserAbortException();
}
}
}
}