Differential - allow setting viewPolicy from web ui during diff creation process

Summary: Fixes T6152, T6237. This introduces a viewPolicy column to the DifferentialDiff, and re-jiggers the DifferentialDiff policy implementation such that things behave as before once associated with a revision, else use the DifferentialDiff policy column value.

Test Plan: made a diff with a non-standard view policy and noted that policy was still selected in the revision step. arc lint.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6237, T6152

Differential Revision: https://secure.phabricator.com/D10875
This commit is contained in:
Bob Trahan
2014-11-19 12:16:07 -08:00
parent 7ef236c9a6
commit 4350858628
19 changed files with 108 additions and 26 deletions

View File

@@ -22,7 +22,9 @@ final class DiffusionChangeController extends DiffusionController {
$drequest->updateSymbolicCommit($data['effectiveCommit']);
$raw_changes = ArcanistDiffChange::newFromConduit($data['changes']);
$diff = DifferentialDiff::newFromRawChanges($raw_changes);
$diff = DifferentialDiff::newFromRawChanges(
$viewer,
$raw_changes);
$changesets = $diff->getChangesets();
$changeset = reset($changesets);

View File

@@ -276,6 +276,7 @@ final class DiffusionCommitController extends DiffusionController {
$content[] = $change_panel;
$changesets = DiffusionPathChange::convertToDifferentialChangesets(
$user,
$changes);
$vcs = $repository->getVersionControlSystem();

View File

@@ -54,7 +54,9 @@ final class DiffusionDiffController extends DiffusionController {
));
$drequest->updateSymbolicCommit($data['effectiveCommit']);
$raw_changes = ArcanistDiffChange::newFromConduit($data['changes']);
$diff = DifferentialDiff::newFromRawChanges($raw_changes);
$diff = DifferentialDiff::newFromRawChanges(
$user,
$raw_changes);
$changesets = $diff->getChangesets();
$changeset = reset($changesets);

View File

@@ -142,10 +142,12 @@ final class DiffusionPathChange {
return array_select_keys($result, $direct);
}
final public static function convertToDifferentialChangesets(array $changes) {
final public static function convertToDifferentialChangesets(
PhabricatorUser $user,
array $changes) {
assert_instances_of($changes, 'DiffusionPathChange');
$arcanist_changes = self::convertToArcanistChanges($changes);
$diff = DifferentialDiff::newFromRawChanges($arcanist_changes);
$diff = DifferentialDiff::newFromRawChanges($user, $arcanist_changes);
return $diff->getChangesets();
}

View File

@@ -1115,7 +1115,9 @@ final class DiffusionCommitHookEngine extends Phobject {
$parser = new ArcanistDiffParser();
$changes = $parser->parseDiff($raw_diff);
$diff = DifferentialDiff::newFromRawChanges($changes);
$diff = DifferentialDiff::newFromRawChanges(
$this->getViewer(),
$changes);
return $diff->getChangesets();
}