1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-30 16:38:21 +01:00

Use correct transaction types when creating diffs

Summary: See T10214 for context.  These transaction types are obviously wrong as far as I can tell.

Test Plan:
Created a revision and didn't see an error in the daemon log.

```lang=php
<?php

require_once dirname(__FILE__).'/phabricator/scripts/__init_script__.php';

$yelirekim = (new PhabricatorPeopleQuery)
  ->setViewer(PhabricatorUser::getOmnipotentUser())
  ->withUsernames(['yelirekim'])
  ->executeOne();

$raw_diff = (new PhabricatorDifferenceEngine)
  ->generateRawDiffFromFileContent('oldfile', 'newfile');
$diff = (new ConduitCall('differential.createrawdiff', [
      'diff' => $raw_diff,
    ]))
  ->setUser($yelirekim)
  ->execute();

$xactions = (new DifferentialDiffTransactionQuery)
  ->setViewer($yelirekim)
  ->withObjectPHIDs([$diff['phid']])
  ->execute();

foreach ($xactions as $xaction) {
  echo $xaction->getPHID().':'.$xaction->getTitle().PHP_EOL;
}
```

for sanity

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: michaeljs1990, epriestley

Differential Revision: https://secure.phabricator.com/D15112
This commit is contained in:
Mike Riley 2016-01-25 02:17:42 -08:00 committed by epriestley
parent a9e2e6c5aa
commit e7195628d5
2 changed files with 3 additions and 3 deletions

View file

@ -137,7 +137,7 @@ final class DifferentialCreateDiffConduitAPIMethod
);
$xactions = array(
id(new DifferentialTransaction())
id(new DifferentialDiffTransaction())
->setTransactionType(DifferentialDiffTransaction::TYPE_DIFF_CREATE)
->setNewValue($diff_data_dict),
);

View file

@ -72,13 +72,13 @@ final class DifferentialCreateRawDiffConduitAPIMethod
);
$xactions = array(
id(new DifferentialTransaction())
id(new DifferentialDiffTransaction())
->setTransactionType(DifferentialDiffTransaction::TYPE_DIFF_CREATE)
->setNewValue($diff_data_dict),
);
if ($request->getValue('viewPolicy')) {
$xactions[] = id(new DifferentialTransaction())
$xactions[] = id(new DifferentialDiffTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
->setNewValue($request->getValue('viewPolicy'));
}