Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/differential/xaction/DifferentialRevisionCloseTransaction.php b/src/applications/differential/xaction/DifferentialRevisionCloseTransaction.php
index f20ba7a011..857bcc870b 100644
--- a/src/applications/differential/xaction/DifferentialRevisionCloseTransaction.php
+++ b/src/applications/differential/xaction/DifferentialRevisionCloseTransaction.php
@@ -1,157 +1,149 @@
<?php
final class DifferentialRevisionCloseTransaction
extends DifferentialRevisionActionTransaction {
const TRANSACTIONTYPE = 'differential.revision.close';
const ACTIONKEY = 'close';
protected function getRevisionActionLabel() {
return pht('Close Revision');
}
protected function getRevisionActionDescription(
DifferentialRevision $revision) {
return pht('This revision will be closed.');
}
public function getIcon() {
return 'fa-check';
}
public function getColor() {
return 'indigo';
}
protected function getRevisionActionOrder() {
return 300;
}
public function getActionName() {
return pht('Closed');
}
public function generateOldValue($object) {
return $object->isClosed();
}
public function applyInternalEffects($object, $value) {
$was_accepted = $object->isAccepted();
$status_published = DifferentialRevisionStatus::PUBLISHED;
$object->setModernRevisionStatus($status_published);
$object->setProperty(
DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED,
$was_accepted);
}
protected function validateAction($object, PhabricatorUser $viewer) {
if ($this->hasEditor()) {
if ($this->getEditor()->getIsCloseByCommit()) {
// If we're closing a revision because we discovered a commit, we don't
// care what state it was in.
return;
}
}
if ($object->isClosed()) {
throw new Exception(
pht(
'You can not close this revision because it has already been '.
'closed. Only open revisions can be closed.'));
}
if (!$object->isAccepted()) {
throw new Exception(
pht(
'You can not close this revision because it has not been accepted. '.
'Revisions must be accepted before they can be closed.'));
}
$config_key = 'differential.always-allow-close';
if (!PhabricatorEnv::getEnvConfig($config_key)) {
if (!$this->isViewerRevisionAuthor($object, $viewer)) {
throw new Exception(
pht(
'You can not close this revision because you are not the '.
'author. You can only close revisions you own. You can change '.
'this behavior by adjusting the "%s" setting in Config.',
$config_key));
}
}
}
public function getTitle() {
- if (!$this->getMetadataValue('isCommitClose')) {
- return pht(
- '%s closed this revision.',
- $this->renderAuthor());
- }
-
$commit_phid = $this->getMetadataValue('commitPHID');
- $committer_phid = $this->getMetadataValue('committerPHID');
- $author_phid = $this->getMetadataValue('authorPHID');
-
- if ($committer_phid) {
- $committer_name = $this->renderHandle($committer_phid);
+ if ($commit_phid) {
+ $commit = id(new DiffusionCommitQuery())
+ ->setViewer($this->getViewer())
+ ->withPHIDs(array($commit_phid))
+ ->needIdentities(true)
+ ->executeOne();
} else {
- $committer_name = $this->getMetadataValue('committerName');
+ $commit = null;
}
- if ($author_phid) {
- $author_name = $this->renderHandle($author_phid);
- } else {
- $author_name = $this->getMetadatavalue('authorName');
+ if (!$commit) {
+ return pht(
+ '%s closed this revision.',
+ $this->renderAuthor());
}
- $same_phid =
- strlen($committer_phid) &&
- strlen($author_phid) &&
- ($committer_phid == $author_phid);
-
- $same_name =
- !strlen($committer_phid) &&
- !strlen($author_phid) &&
- ($committer_name == $author_name);
+ $author_phid = $commit->getAuthorDisplayPHID();
+ $committer_phid = $commit->getCommitterDisplayPHID();
- if ($same_name || $same_phid) {
+ if (!$author_phid) {
+ return pht(
+ 'Closed by commit %s.',
+ $this->renderHandle($commit_phid));
+ } else if (!$committer_phid || ($committer_phid === $author_phid)) {
return pht(
'Closed by commit %s (authored by %s).',
$this->renderHandle($commit_phid),
- $author_name);
+ $this->renderHandle($author_phid));
} else {
return pht(
'Closed by commit %s (authored by %s, committed by %s).',
$this->renderHandle($commit_phid),
- $author_name,
- $committer_name);
+ $this->renderHandle($author_phid),
+ $this->renderHandle($committer_phid));
}
}
public function getTitleForFeed() {
return pht(
'%s closed %s.',
$this->renderAuthor(),
$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,
);
}
}
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementUnpublishWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementUnpublishWorkflow.php
index 5a6afb8c6e..418030864d 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementUnpublishWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementUnpublishWorkflow.php
@@ -1,273 +1,271 @@
<?php
final class PhabricatorRepositoryManagementUnpublishWorkflow
extends PhabricatorRepositoryManagementWorkflow {
protected function didConstruct() {
$this
->setName('unpublish')
->setExamples(
'**unpublish** [__options__] __repository__')
->setSynopsis(
pht(
'Unpublish all feed stories and notifications that a repository '.
'has generated. Keep expectations low; can not rewind time.'))
->setArguments(
array(
array(
'name' => 'force',
'help' => pht('Do not prompt for confirmation.'),
),
array(
'name' => 'dry-run',
'help' => pht('Do not perform any writes.'),
),
array(
'name' => 'repositories',
'wildcard' => true,
),
));
}
public function execute(PhutilArgumentParser $args) {
$viewer = $this->getViewer();
$is_force = $args->getArg('force');
$is_dry_run = $args->getArg('dry-run');
$repositories = $this->loadLocalRepositories($args, 'repositories');
if (count($repositories) !== 1) {
throw new PhutilArgumentUsageException(
pht('Specify exactly one repository to unpublish.'));
}
$repository = head($repositories);
if (!$is_force) {
echo tsprintf(
"%s\n",
pht(
'This script will unpublish all feed stories and notifications '.
'which a repository generated during import. This action can not '.
'be undone.'));
$prompt = pht(
'Permanently unpublish "%s"?',
$repository->getDisplayName());
if (!phutil_console_confirm($prompt)) {
throw new PhutilArgumentUsageException(
pht('User aborted workflow.'));
}
}
$commits = id(new DiffusionCommitQuery())
->setViewer($viewer)
->withRepositoryPHIDs(array($repository->getPHID()))
->execute();
echo pht("Will unpublish %s commits.\n", count($commits));
foreach ($commits as $commit) {
$this->unpublishCommit($commit, $is_dry_run);
}
return 0;
}
private function unpublishCommit(
PhabricatorRepositoryCommit $commit,
$is_dry_run) {
$viewer = $this->getViewer();
echo tsprintf(
"%s\n",
pht(
'Unpublishing commit "%s".',
$commit->getMonogram()));
$stories = id(new PhabricatorFeedQuery())
->setViewer($viewer)
->withFilterPHIDs(array($commit->getPHID()))
->execute();
if ($stories) {
echo tsprintf(
"%s\n",
pht(
'Found %s feed storie(s).',
count($stories)));
if (!$is_dry_run) {
$engine = new PhabricatorDestructionEngine();
foreach ($stories as $story) {
$story_data = $story->getStoryData();
$engine->destroyObject($story_data);
}
echo tsprintf(
"%s\n",
pht(
'Destroyed %s feed storie(s).',
count($stories)));
}
}
$edge_types = array(
PhabricatorObjectMentionsObjectEdgeType::EDGECONST => true,
DiffusionCommitHasTaskEdgeType::EDGECONST => true,
DiffusionCommitHasRevisionEdgeType::EDGECONST => true,
DiffusionCommitRevertsCommitEdgeType::EDGECONST => true,
);
$query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(array($commit->getPHID()))
->withEdgeTypes(array_keys($edge_types));
$edges = $query->execute();
foreach ($edges[$commit->getPHID()] as $type => $edge_list) {
foreach ($edge_list as $edge) {
$dst = $edge['dst'];
echo tsprintf(
"%s\n",
pht(
'Commit "%s" has edge of type "%s" to object "%s".',
$commit->getMonogram(),
$type,
$dst));
$object = id(new PhabricatorObjectQuery())
->setViewer($viewer)
->withPHIDs(array($dst))
->executeOne();
if ($object) {
if ($object instanceof PhabricatorApplicationTransactionInterface) {
$this->unpublishEdgeTransaction(
$commit,
$type,
$object,
$is_dry_run);
}
}
}
}
}
private function unpublishEdgeTransaction(
$src,
$type,
PhabricatorApplicationTransactionInterface $dst,
$is_dry_run) {
$viewer = $this->getViewer();
$query = PhabricatorApplicationTransactionQuery::newQueryForObject($dst)
->setViewer($viewer)
->withObjectPHIDs(array($dst->getPHID()));
$xactions = id(clone $query)
->withTransactionTypes(
array(
PhabricatorTransactions::TYPE_EDGE,
))
->execute();
$type_obj = PhabricatorEdgeType::getByConstant($type);
$inverse_type = $type_obj->getInverseEdgeConstant();
$engine = new PhabricatorDestructionEngine();
foreach ($xactions as $xaction) {
$edge_type = $xaction->getMetadataValue('edge:type');
if ($edge_type != $inverse_type) {
// Some other type of edge was edited.
continue;
}
$record = PhabricatorEdgeChangeRecord::newFromTransaction($xaction);
$changed = $record->getChangedPHIDs();
if ($changed !== array($src->getPHID())) {
// Affected objects were not just the object we're unpublishing.
continue;
}
echo tsprintf(
"%s\n",
pht(
'Found edge transaction "%s" on object "%s" for type "%s".',
$xaction->getPHID(),
$dst->getPHID(),
$type));
if (!$is_dry_run) {
$engine->destroyObject($xaction);
echo tsprintf(
"%s\n",
pht(
'Destroyed transaction "%s" on object "%s".',
$xaction->getPHID(),
$dst->getPHID()));
}
}
if ($type === DiffusionCommitHasTaskEdgeType::EDGECONST) {
$xactions = id(clone $query)
->withTransactionTypes(
array(
ManiphestTaskStatusTransaction::TRANSACTIONTYPE,
))
->execute();
if ($xactions) {
foreach ($xactions as $xaction) {
$metadata = $xaction->getMetadata();
if (idx($metadata, 'commitPHID') === $src->getPHID()) {
echo tsprintf(
"%s\n",
pht(
'MANUAL Task "%s" was likely closed improperly by "%s".',
$dst->getMonogram(),
$src->getMonogram()));
}
}
}
}
if ($type === DiffusionCommitHasRevisionEdgeType::EDGECONST) {
$xactions = id(clone $query)
->withTransactionTypes(
array(
DifferentialRevisionCloseTransaction::TRANSACTIONTYPE,
))
->execute();
if ($xactions) {
foreach ($xactions as $xaction) {
$metadata = $xaction->getMetadata();
- if (idx($metadata, 'isCommitClose')) {
- if (idx($metadata, 'commitPHID') === $src->getPHID()) {
- echo tsprintf(
- "%s\n",
- pht(
- 'MANUAL Revision "%s" was likely closed improperly by "%s".',
- $dst->getMonogram(),
- $src->getMonogram()));
- }
+ if (idx($metadata, 'commitPHID') === $src->getPHID()) {
+ echo tsprintf(
+ "%s\n",
+ pht(
+ 'MANUAL Revision "%s" was likely closed improperly by "%s".',
+ $dst->getMonogram(),
+ $src->getMonogram()));
}
}
}
}
if (!$is_dry_run) {
id(new PhabricatorEdgeEditor())
->removeEdge($src->getPHID(), $type, $dst->getPHID())
->save();
echo tsprintf(
"%s\n",
pht(
'Destroyed edge of type "%s" between "%s" and "%s".',
$type,
$src->getPHID(),
$dst->getPHID()));
}
}
}
diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
index b0583725a9..e6c9f499b1 100644
--- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
+++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
@@ -1,448 +1,435 @@
<?php
abstract class PhabricatorRepositoryCommitMessageParserWorker
extends PhabricatorRepositoryCommitParserWorker {
protected function getImportStepFlag() {
return PhabricatorRepositoryCommit::IMPORTED_MESSAGE;
}
abstract protected function getFollowupTaskClass();
final protected function parseCommit(
PhabricatorRepository $repository,
PhabricatorRepositoryCommit $commit) {
if (!$this->shouldSkipImportStep()) {
$viewer = PhabricatorUser::getOmnipotentUser();
$refs_raw = DiffusionQuery::callConduitWithDiffusionRequest(
$viewer,
DiffusionRequest::newFromDictionary(
array(
'repository' => $repository,
'user' => $viewer,
)),
'diffusion.querycommits',
array(
'repositoryPHID' => $repository->getPHID(),
'phids' => array($commit->getPHID()),
'bypassCache' => true,
'needMessages' => true,
));
if (empty($refs_raw['data'])) {
throw new Exception(
pht(
'Unable to retrieve details for commit "%s"!',
$commit->getPHID()));
}
$ref = DiffusionCommitRef::newFromConduitResult(head($refs_raw['data']));
$this->updateCommitData($ref);
}
if ($this->shouldQueueFollowupTasks()) {
$this->queueTask(
$this->getFollowupTaskClass(),
array(
'commitID' => $commit->getID(),
),
array(
// We queue followup tasks at default priority so that the queue
// finishes work it has started before starting more work. If
// followups are queued at the same priority level, we do all
// message parses first, then all change parses, etc. This makes
// progress uneven. See T11677 for discussion.
'priority' => PhabricatorWorker::PRIORITY_DEFAULT,
));
}
}
final protected function updateCommitData(DiffusionCommitRef $ref) {
$commit = $this->commit;
$author = $ref->getAuthor();
$message = $ref->getMessage();
$committer = $ref->getCommitter();
$hashes = $ref->getHashes();
$author_identity = id(new PhabricatorRepositoryIdentityQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withIdentityNames(array($author))
->executeOne();
if (!$author_identity) {
$author_identity = id(new PhabricatorRepositoryIdentity())
->setAuthorPHID($commit->getPHID())
->setIdentityName($author)
->setAutomaticGuessedUserPHID(
$this->resolveUserPHID($commit, $author))
->save();
}
$committer_identity = null;
if ($committer) {
$committer_identity = id(new PhabricatorRepositoryIdentityQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withIdentityNames(array($committer))
->executeOne();
if (!$committer_identity) {
$committer_identity = id(new PhabricatorRepositoryIdentity())
->setAuthorPHID($commit->getPHID())
->setIdentityName($committer)
->setAutomaticGuessedUserPHID(
$this->resolveUserPHID($commit, $committer))
->save();
}
}
$data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
'commitID = %d',
$commit->getID());
if (!$data) {
$data = new PhabricatorRepositoryCommitData();
}
$data->setCommitID($commit->getID());
$data->setAuthorName(id(new PhutilUTF8StringTruncator())
->setMaximumBytes(255)
->truncateString((string)$author));
$data->setCommitDetail('authorEpoch', $ref->getAuthorEpoch());
$data->setCommitDetail('authorName', $ref->getAuthorName());
$data->setCommitDetail('authorEmail', $ref->getAuthorEmail());
$data->setCommitDetail(
'authorIdentityPHID', $author_identity->getPHID());
$data->setCommitDetail(
'authorPHID',
$this->resolveUserPHID($commit, $author));
$data->setCommitMessage($message);
if (strlen($committer)) {
$data->setCommitDetail('committer', $committer);
$data->setCommitDetail('committerName', $ref->getCommitterName());
$data->setCommitDetail('committerEmail', $ref->getCommitterEmail());
$data->setCommitDetail(
'committerPHID',
$this->resolveUserPHID($commit, $committer));
$data->setCommitDetail(
'committerIdentityPHID', $committer_identity->getPHID());
$commit->setCommitterIdentityPHID($committer_identity->getPHID());
}
$repository = $this->repository;
$author_phid = $data->getCommitDetail('authorPHID');
$committer_phid = $data->getCommitDetail('committerPHID');
$user = new PhabricatorUser();
if ($author_phid) {
$user = $user->loadOneWhere(
'phid = %s',
$author_phid);
}
$differential_app = 'PhabricatorDifferentialApplication';
$revision_id = null;
$low_level_query = null;
if (PhabricatorApplication::isClassInstalled($differential_app)) {
$low_level_query = id(new DiffusionLowLevelCommitFieldsQuery())
->setRepository($repository)
->withCommitRef($ref);
$field_values = $low_level_query->execute();
$revision_id = idx($field_values, 'revisionID');
if (!empty($field_values['reviewedByPHIDs'])) {
$data->setCommitDetail(
'reviewerPHID',
reset($field_values['reviewedByPHIDs']));
}
$data->setCommitDetail('differential.revisionID', $revision_id);
}
if ($author_phid != $commit->getAuthorPHID()) {
$commit->setAuthorPHID($author_phid);
}
$commit->setAuthorIdentityPHID($author_identity->getPHID());
$commit->setSummary($data->getSummary());
$commit->save();
// Figure out if we're going to try to "autoclose" related objects (e.g.,
// close linked tasks and related revisions) and, if not, record why we
// aren't. Autoclose can be disabled for various reasons at the repository
// or commit levels.
$force_autoclose = idx($this->getTaskData(), 'forceAutoclose', false);
if ($force_autoclose) {
$autoclose_reason = PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED;
} else {
$autoclose_reason = $repository->shouldSkipAutocloseCommit($commit);
}
$data->setCommitDetail('autocloseReason', $autoclose_reason);
$should_autoclose = $force_autoclose ||
$repository->shouldAutocloseCommit($commit);
// When updating related objects, we'll act under an omnipotent user to
// ensure we can see them, but take actions as either the committer or
// author (if we recognize their accounts) or the Diffusion application
// (if we do not).
$actor = PhabricatorUser::getOmnipotentUser();
$acting_as_phid = nonempty(
$committer_phid,
$author_phid,
id(new PhabricatorDiffusionApplication())->getPHID());
$acting_user = $this->loadActingUser($actor, $acting_as_phid);
$conn_w = id(new DifferentialRevision())->establishConnection('w');
// NOTE: The `differential_commit` table has a unique ID on `commitPHID`,
// preventing more than one revision from being associated with a commit.
// Generally this is good and desirable, but with the advent of hash
// tracking we may end up in a situation where we match several different
// revisions. We just kind of ignore this and pick one, we might want to
// revisit this and do something differently. (If we match several revisions
// someone probably did something very silly, though.)
$revision = null;
if ($revision_id) {
$revision_query = id(new DifferentialRevisionQuery())
->withIDs(array($revision_id))
->setViewer($actor)
->needReviewers(true)
->needActiveDiffs(true);
$revision = $revision_query->executeOne();
if ($revision) {
$commit_drev = DiffusionCommitHasRevisionEdgeType::EDGECONST;
id(new PhabricatorEdgeEditor())
->addEdge($commit->getPHID(), $commit_drev, $revision->getPHID())
->save();
queryfx(
$conn_w,
'INSERT IGNORE INTO %T (revisionID, commitPHID) VALUES (%d, %s)',
DifferentialRevision::TABLE_COMMIT,
$revision->getID(),
$commit->getPHID());
$should_close = !$revision->isPublished() && $should_autoclose;
if ($should_close) {
$type_close = DifferentialRevisionCloseTransaction::TRANSACTIONTYPE;
$commit_close_xaction = id(new DifferentialTransaction())
->setTransactionType($type_close)
- ->setNewValue(true)
- ->setMetadataValue('isCommitClose', true);
+ ->setNewValue(true);
$commit_close_xaction->setMetadataValue(
'commitPHID',
$commit->getPHID());
- $commit_close_xaction->setMetadataValue(
- 'committerPHID',
- $committer_phid);
- $commit_close_xaction->setMetadataValue(
- 'committerName',
- $data->getCommitDetail('committer'));
- $commit_close_xaction->setMetadataValue(
- 'authorPHID',
- $author_phid);
- $commit_close_xaction->setMetadataValue(
- 'authorName',
- $data->getAuthorName());
if ($low_level_query) {
$commit_close_xaction->setMetadataValue(
'revisionMatchData',
$low_level_query->getRevisionMatchData());
$data->setCommitDetail(
'revisionMatchData',
$low_level_query->getRevisionMatchData());
}
$extraction_engine = id(new DifferentialDiffExtractionEngine())
->setViewer($actor)
->setAuthorPHID($acting_as_phid);
$content_source = $this->newContentSource();
$extraction_engine->updateRevisionWithCommit(
$revision,
$commit,
array(
$commit_close_xaction,
),
$content_source);
}
}
}
if ($should_autoclose) {
$this->closeTasks(
$actor,
$acting_as_phid,
$repository,
$commit,
$message,
$acting_user);
}
$data->save();
$commit->writeImportStatusFlag(
PhabricatorRepositoryCommit::IMPORTED_MESSAGE);
}
private function resolveUserPHID(
PhabricatorRepositoryCommit $commit,
$user_name) {
return id(new DiffusionResolveUserQuery())
->withCommit($commit)
->withName($user_name)
->execute();
}
private function closeTasks(
PhabricatorUser $actor,
$acting_as,
PhabricatorRepository $repository,
PhabricatorRepositoryCommit $commit,
$message,
PhabricatorUser $acting_user = null) {
// If we we were able to identify an author for the commit, we try to act
// as that user when loading tasks marked with "Fixes Txxx". This prevents
// mistakes where a user accidentally writes the wrong task IDs and affects
// tasks they can't see (and thus can't undo the status changes for).
// This is just a guard rail, not a security measure. An attacker can still
// forge another user's identity trivially by forging author or committer
// emails. We also let commits with unrecognized authors act on any task to
// make behavior less confusing for new installs.
if (!$acting_user) {
$acting_user = $actor;
}
$maniphest = 'PhabricatorManiphestApplication';
if (!PhabricatorApplication::isClassInstalled($maniphest)) {
return;
}
$prefixes = ManiphestTaskStatus::getStatusPrefixMap();
$suffixes = ManiphestTaskStatus::getStatusSuffixMap();
$matches = id(new ManiphestCustomFieldStatusParser())
->parseCorpus($message);
$task_statuses = array();
foreach ($matches as $match) {
$prefix = phutil_utf8_strtolower($match['prefix']);
$suffix = phutil_utf8_strtolower($match['suffix']);
$status = idx($suffixes, $suffix);
if (!$status) {
$status = idx($prefixes, $prefix);
}
foreach ($match['monograms'] as $task_monogram) {
$task_id = (int)trim($task_monogram, 'tT');
$task_statuses[$task_id] = $status;
}
}
if (!$task_statuses) {
return;
}
$tasks = id(new ManiphestTaskQuery())
->setViewer($acting_user)
->withIDs(array_keys($task_statuses))
->needProjectPHIDs(true)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->execute();
foreach ($tasks as $task_id => $task) {
$xactions = array();
$edge_type = ManiphestTaskHasCommitEdgeType::EDGECONST;
$edge_xaction = id(new ManiphestTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
->setMetadataValue('edge:type', $edge_type)
->setNewValue(
array(
'+' => array(
$commit->getPHID() => $commit->getPHID(),
),
));
$status = $task_statuses[$task_id];
if ($status) {
if ($task->getStatus() != $status) {
$xactions[] = id(new ManiphestTransaction())
->setTransactionType(
ManiphestTaskStatusTransaction::TRANSACTIONTYPE)
->setMetadataValue('commitPHID', $commit->getPHID())
->setNewValue($status);
$edge_xaction->setMetadataValue('commitPHID', $commit->getPHID());
}
}
$xactions[] = $edge_xaction;
$content_source = $this->newContentSource();
$editor = id(new ManiphestTransactionEditor())
->setActor($actor)
->setActingAsPHID($acting_as)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
->setUnmentionablePHIDMap(
array($commit->getPHID() => $commit->getPHID()))
->setContentSource($content_source);
$editor->applyTransactions($task, $xactions);
}
}
private function loadActingUser(PhabricatorUser $viewer, $user_phid) {
if (!$user_phid) {
return null;
}
$user_type = PhabricatorPeopleUserPHIDType::TYPECONST;
if (phid_get_type($user_phid) != $user_type) {
return null;
}
$user = id(new PhabricatorPeopleQuery())
->setViewer($viewer)
->withPHIDs(array($user_phid))
->executeOne();
if (!$user) {
return null;
}
return $user;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Wed, Jun 11, 12:21 AM (19 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
141463
Default Alt Text
(28 KB)

Event Timeline