mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +01:00
Restore the --edit workflow somewhat properly. (2)
Summary: summary999 Test Plan: test2 Reviewers: CC: Differential Revision: 219938
This commit is contained in:
parent
d9e8c2d0aa
commit
0a0aa6d718
1 changed files with 59 additions and 8 deletions
|
@ -337,6 +337,8 @@ EOTEXT
|
||||||
'differential.getcommitmessage',
|
'differential.getcommitmessage',
|
||||||
array(
|
array(
|
||||||
'revision_id' => $message->getRevisionID(),
|
'revision_id' => $message->getRevisionID(),
|
||||||
|
'edit' => true,
|
||||||
|
'fields' => array(),
|
||||||
));
|
));
|
||||||
$remote_message = ArcanistDifferentialCommitMessage::newFromRawCorpus(
|
$remote_message = ArcanistDifferentialCommitMessage::newFromRawCorpus(
|
||||||
$remote_corpus);
|
$remote_corpus);
|
||||||
|
@ -365,15 +367,64 @@ EOTEXT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$revision['fields'] = $remote_message->getFields();
|
||||||
|
|
||||||
if ($should_edit) {
|
if ($should_edit) {
|
||||||
// TODO: lol. But we need differential.unparsecommitmessage or
|
$updated_corpus = $conduit->callMethodSynchronous(
|
||||||
// something.
|
'differential.getcommitmessage',
|
||||||
throw new ArcanistUsageException(
|
array(
|
||||||
'--edit is not supported yet. Edit revisions from the web '.
|
'revision_id' => $message->getRevisionID(),
|
||||||
'UI.');
|
'edit' => true,
|
||||||
|
'fields' => $message->getFields(),
|
||||||
|
));
|
||||||
|
$new_text = id(new PhutilInteractiveEditor($updated_corpus))
|
||||||
|
->setName('differential-edit-revision-info')
|
||||||
|
->editInteractively();
|
||||||
|
$new_message = ArcanistDifferentialCommitMessage::newFromRawCorpus(
|
||||||
|
$new_text);
|
||||||
|
$new_message->pullDataFromConduit($conduit);
|
||||||
|
/*
|
||||||
|
TODO: restore these checks
|
||||||
|
|
||||||
|
|
||||||
|
try { // <<< this try goes right after the edit
|
||||||
|
|
||||||
|
if (!$new_message->getTitle()) {
|
||||||
|
throw new UsageException(
|
||||||
|
"You can not remove the Revision title.");
|
||||||
|
}
|
||||||
|
if (!$new_message->getTestPlan()) {
|
||||||
|
throw new UsageException(
|
||||||
|
"You can not remove the 'Test Plan'.");
|
||||||
|
}
|
||||||
|
if ($new_message->getRevisionID() != $revision->getID()) {
|
||||||
|
throw new UsageException(
|
||||||
|
"You changed or deleted the Differential revision ID! Why ".
|
||||||
|
"would you do that?!");
|
||||||
}
|
}
|
||||||
|
|
||||||
$revision['fields'] = $remote_message->getFields();
|
} catch (Exception $ex) {
|
||||||
|
$ii = 0;
|
||||||
|
do {
|
||||||
|
$name = $ii
|
||||||
|
? 'differential-message-'.$ii.'.txt'
|
||||||
|
: 'differential-message.txt';
|
||||||
|
if (!file_exists($name)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++$ii;
|
||||||
|
} while(true);
|
||||||
|
require_module_lazy('resource/filesystem');
|
||||||
|
Filesystem::writeFile($name, $new_text);
|
||||||
|
echo "Exception! Message was saved to '{$name}'.\n";
|
||||||
|
throw $ex;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$revision['fields'] = $new_message->getFields();
|
||||||
|
}
|
||||||
|
|
||||||
$update_message = $this->getUpdateMessage();
|
$update_message = $this->getUpdateMessage();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue