mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 06:42:41 +01:00
Partially restore --edit to stop it from stomping all over everything.
Summary: We sync from local right now, which is fairly terrible. But fixing this correctly is also not trivial and I don't have the right primitives yet. Test Plan: Reviewers: CC:
This commit is contained in:
parent
5099b005cf
commit
a4d30cc42b
2 changed files with 56 additions and 0 deletions
|
@ -80,6 +80,11 @@ class ArcanistDifferentialCommitMessage {
|
|||
return null;
|
||||
}
|
||||
|
||||
public function setFieldValue($key, $value) {
|
||||
$this->fields[$key] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFields() {
|
||||
return $this->fields;
|
||||
}
|
||||
|
@ -96,4 +101,11 @@ class ArcanistDifferentialCommitMessage {
|
|||
return $this->gitSVNUUID;
|
||||
}
|
||||
|
||||
public function getChecksum() {
|
||||
$fields = array_filter($this->fields);
|
||||
ksort($fields);
|
||||
$fields = json_encode($fields);
|
||||
return md5($fields);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -328,6 +328,50 @@ EOTEXT
|
|||
);
|
||||
|
||||
if ($message->getRevisionID()) {
|
||||
// TODO: This is silly -- we're getting a text corpus from the server
|
||||
// and then sending it right back to be parsed. This should be a
|
||||
// single call.
|
||||
$remote_corpus = $conduit->callMethodSynchronous(
|
||||
'differential.getcommitmessage',
|
||||
array(
|
||||
'revision_id' => $message->getRevisionID(),
|
||||
));
|
||||
$remote_message = ArcanistDifferentialCommitMessage::newFromRawCorpus(
|
||||
$remote_corpus);
|
||||
$remote_message->pullDataFromConduit($conduit);
|
||||
|
||||
// TODO: We should throw here if you deleted the 'testPlan'.
|
||||
|
||||
$sync = array('title', 'summary', 'testPlan');
|
||||
foreach ($sync as $field) {
|
||||
$local = $message->getFieldValue($field);
|
||||
$remote_message->setFieldValue($field, $local);
|
||||
}
|
||||
|
||||
$should_edit = $this->getArgument('edit');
|
||||
if (!$should_edit) {
|
||||
$local_sum = $message->getChecksum();
|
||||
$remote_sum = $remote_message->getChecksum();
|
||||
if ($local_sum != $remote_sum) {
|
||||
$prompt =
|
||||
"You have made local changes to your commit message. Arcanist ".
|
||||
"ignores most local changes. Instead, use the '--edit' flag to ".
|
||||
"edit revision information. Edit revision information now?";
|
||||
$should_edit = phutil_console_confirm(
|
||||
$prompt,
|
||||
$default_no = false);
|
||||
}
|
||||
}
|
||||
|
||||
if ($should_edit) {
|
||||
// TODO: lol. But we need differential.unparsecommitmessage or
|
||||
// something.
|
||||
throw new ArcanistUsageException(
|
||||
'--edit is not supported yet. Edit revisions from the web '.
|
||||
'UI.');
|
||||
}
|
||||
|
||||
$revision['fields'] = $remote_message->getFields();
|
||||
|
||||
$update_message = $this->getUpdateMessage();
|
||||
|
||||
|
|
Loading…
Reference in a new issue