Return commit information for Revision "close" and "update" transactions over the Conduit API
Summary: Depends on D19175. Ref T13099. This fills in "close" and "update" transactions so that they show which commit(s) caused the action. Test Plan: Used `transaction.search` to query some revisions, saw commit PHID information. Maniphest Tasks: T13099 Differential Revision: https://secure.phabricator.com/D19176
This commit is contained in:
		@@ -284,7 +284,8 @@ final class DifferentialDiffExtractionEngine extends Phobject {
 | 
			
		||||
      ->setTransactionType($type_update)
 | 
			
		||||
      ->setIgnoreOnNoEffect(true)
 | 
			
		||||
      ->setNewValue($new_diff->getPHID())
 | 
			
		||||
      ->setMetadataValue('isCommitUpdate', true);
 | 
			
		||||
      ->setMetadataValue('isCommitUpdate', true)
 | 
			
		||||
      ->setMetadataValue('commitPHIDs', array($commit->getPHID()));
 | 
			
		||||
 | 
			
		||||
    foreach ($more_xactions as $more_xaction) {
 | 
			
		||||
      $xactions[] = $more_xaction;
 | 
			
		||||
 
 | 
			
		||||
@@ -136,4 +136,23 @@ final class DifferentialRevisionCloseTransaction
 | 
			
		||||
      $this->renderObject());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public function getTransactionTypeForConduit($xaction) {
 | 
			
		||||
    return 'close';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public function getFieldValuesForConduit($object, $data) {
 | 
			
		||||
    $commit_phid = $object->getMetadataValue('commitPHID');
 | 
			
		||||
 | 
			
		||||
    if ($commit_phid) {
 | 
			
		||||
      $commit_phids = array($commit_phid);
 | 
			
		||||
    } else {
 | 
			
		||||
      $commit_phids = array();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return array(
 | 
			
		||||
      'commitPHIDs' => $commit_phids,
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -182,4 +182,18 @@ final class DifferentialRevisionUpdateTransaction
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public function getTransactionTypeForConduit($xaction) {
 | 
			
		||||
    return 'update';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public function getFieldValuesForConduit($object, $data) {
 | 
			
		||||
    $commit_phids = $object->getMetadataValue('commitPHIDs', array());
 | 
			
		||||
 | 
			
		||||
    return array(
 | 
			
		||||
      'old' => $object->getOldValue(),
 | 
			
		||||
      'new' => $object->getNewValue(),
 | 
			
		||||
      'commitPHIDs' => $commit_phids,
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user