mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 00:32:41 +01:00
Provide more context in "arc diff" messages in Git
Summary: These are the unambiguously-good changes from D2388. Show commits included in a revision in the editor in "arc diff". Test Plan: Ran "arc diff", saw which commits were being included. Reviewers: nh, jungejason, vrana, btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T1183 Differential Revision: https://secure.phabricator.com/D2406
This commit is contained in:
parent
6fcd2db646
commit
9063cfbdba
1 changed files with 44 additions and 13 deletions
|
@ -1341,9 +1341,13 @@ EOTEXT
|
||||||
|
|
||||||
$template_is_default = false;
|
$template_is_default = false;
|
||||||
$notes = array();
|
$notes = array();
|
||||||
|
$included = array();
|
||||||
|
|
||||||
if (!$template) {
|
list($fields, $notes, $included) = $this->getDefaultCreateFields();
|
||||||
list($fields, $notes) = $this->getDefaultCreateFields();
|
if ($template) {
|
||||||
|
$fields = array();
|
||||||
|
$notes = array();
|
||||||
|
} else {
|
||||||
if (!$fields) {
|
if (!$fields) {
|
||||||
$template_is_default = true;
|
$template_is_default = true;
|
||||||
}
|
}
|
||||||
|
@ -1357,15 +1361,38 @@ EOTEXT
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$issues = array(
|
if ($included) {
|
||||||
'NEW DIFFERENTIAL REVISION',
|
foreach ($included as $k => $commit) {
|
||||||
'Describe the changes in this new revision.',
|
$included[$k] = ' '.$commit;
|
||||||
'',
|
}
|
||||||
'arc could not identify any existing revision in your working copy.',
|
$included = array_merge(
|
||||||
'If you intended to update an existing revision, use:',
|
array(
|
||||||
'',
|
"",
|
||||||
' $ arc diff --update <revision>',
|
"Included commits:",
|
||||||
);
|
"",
|
||||||
|
),
|
||||||
|
$included,
|
||||||
|
array(
|
||||||
|
"",
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
$included = array(
|
||||||
|
'',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$issues = array_merge(
|
||||||
|
array(
|
||||||
|
'NEW DIFFERENTIAL REVISION',
|
||||||
|
'Describe the changes in this new revision.',
|
||||||
|
),
|
||||||
|
$included,
|
||||||
|
array(
|
||||||
|
'arc could not identify any existing revision in your working copy.',
|
||||||
|
'If you intended to update an existing revision, use:',
|
||||||
|
'',
|
||||||
|
' $ arc diff --update <revision>',
|
||||||
|
));
|
||||||
if ($notes) {
|
if ($notes) {
|
||||||
$issues = array_merge($issues, array(''), $notes);
|
$issues = array_merge($issues, array(''), $notes);
|
||||||
}
|
}
|
||||||
|
@ -1580,7 +1607,7 @@ EOTEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDefaultCreateFields() {
|
private function getDefaultCreateFields() {
|
||||||
$empty = array(array(), array());
|
$empty = array(array(), array(), array());
|
||||||
|
|
||||||
if ($this->isRawDiffSource()) {
|
if ($this->isRawDiffSource()) {
|
||||||
return $empty;
|
return $empty;
|
||||||
|
@ -1599,6 +1626,7 @@ EOTEXT
|
||||||
private function getGitCreateFields() {
|
private function getGitCreateFields() {
|
||||||
$conduit = $this->getConduit();
|
$conduit = $this->getConduit();
|
||||||
$changes = $this->getLocalGitCommitMessages();
|
$changes = $this->getLocalGitCommitMessages();
|
||||||
|
$included = array();
|
||||||
|
|
||||||
$commits = array();
|
$commits = array();
|
||||||
foreach ($changes as $key => $change) {
|
foreach ($changes as $key => $change) {
|
||||||
|
@ -1609,6 +1637,9 @@ EOTEXT
|
||||||
foreach ($commits as $hash => $text) {
|
foreach ($commits as $hash => $text) {
|
||||||
$messages[$hash] = ArcanistDifferentialCommitMessage::newFromRawCorpus(
|
$messages[$hash] = ArcanistDifferentialCommitMessage::newFromRawCorpus(
|
||||||
$text);
|
$text);
|
||||||
|
|
||||||
|
$first_line = head(explode("\n", trim($text)));
|
||||||
|
$included[] = substr($hash, 0, 12).' '.$first_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = array();
|
$fields = array();
|
||||||
|
@ -1632,7 +1663,7 @@ EOTEXT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($fields, $notes);
|
return array($fields, $notes, $included);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDefaultUpdateMessage() {
|
private function getDefaultUpdateMessage() {
|
||||||
|
|
Loading…
Reference in a new issue