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

Fix some issues with the "Explain Why" dialog

Summary:
Ref T11051. This is still not as clear as it should be, but is at least working as intended now.

I believe this part of the code just never worked. The test plan on D10489 didn't specifically cover it.

Test Plan:
Did this sort of thing in a repository:

```
$ git checkout -b featurex
$ echo x >> y
$ git commit -am wip
$ arc diff
```

Then I simulated just pushing it (this flow is a little more involved than necessary):

```
$ arc land --hold
$ git commit --amend
$ # remove all metadata -- particularly, "Differential Revision"!
$ git push HEAD:master
```

I got a not-great but more-useful dialog:

{F1667318}

Prior to this change, the hash match was incorrectly not reported at all.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11051

Differential Revision: https://secure.phabricator.com/D15989
This commit is contained in:
epriestley 2016-05-30 09:09:49 -07:00
parent b352cae97d
commit e81637a6c6
2 changed files with 7 additions and 3 deletions

View file

@ -93,7 +93,7 @@ final class DifferentialRevisionCloseDetailsController
'href' => $obj_handle->getURI(),
),
$obj_handle->getName());
$body_why = pht(
$body_why[] = pht(
'This commit and the active diff of %s had the same %s hash '.
'(%s) so we linked this commit to %s.',
$diff_link,

View file

@ -67,19 +67,23 @@ final class DiffusionLowLevelCommitFieldsQuery
->withCommitHashes($hash_list)
->execute();
if (!empty($revisions)) {
if ($revisions) {
$revision = $this->pickBestRevision($revisions);
$fields['revisionID'] = $revision->getID();
$revision_hashes = $revision->getHashes();
$revision_hashes = DiffusionCommitHash::convertArrayToObjects(
$revision_hashes);
$revision_hashes = mpull($revision_hashes, 'getHashType');
$revision_hashes = mpull($revision_hashes, null, 'getHashType');
// sort the hashes in the order the mighty
// @{class:ArcanstDifferentialRevisionHash} does; probably unnecessary
// but should future proof things nicely.
$revision_hashes = array_select_keys(
$revision_hashes,
ArcanistDifferentialRevisionHash::getTypes());
foreach ($hashes as $hash) {
$revision_hash = idx($revision_hashes, $hash->getHashType());
if (!$revision_hash) {