Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php b/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php
index f591bad95e..ac7a287c4f 100644
--- a/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php
+++ b/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php
@@ -1,59 +1,52 @@
<?php
final class DifferentialArcanistProjectFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function getRequiredHandlePHIDs() {
$arcanist_phid = $this->getArcanistProjectPHID();
if (!$arcanist_phid) {
return array();
}
return array($arcanist_phid);
}
public function renderLabelForRevisionView() {
return 'Arcanist Project:';
}
public function renderValueForRevisionView() {
$arcanist_phid = $this->getArcanistProjectPHID();
if (!$arcanist_phid) {
return null;
}
$handle = $this->getHandle($arcanist_phid);
return $handle->getName();
}
private function getArcanistProjectPHID() {
$diff = $this->getDiff();
return $diff->getArcanistProjectPHID();
}
public function renderValueForMail($phase) {
- $status = $this->getRevision()->getStatus();
-
- if ($status != ArcanistDifferentialRevisionStatus::NEEDS_REVISION &&
- $status != ArcanistDifferentialRevisionStatus::ACCEPTED) {
- return null;
- }
-
$diff = $this->getRevision()->loadActiveDiff();
if ($diff) {
$phid = $diff->getArcanistProjectPHID();
if ($phid) {
$handle = id(new PhabricatorHandleQuery())
->setViewer($this->getUser())
->withPHIDs(array($phid))
->executeOne();
return "ARCANIST PROJECT\n ".$handle->getName();
}
}
}
}
diff --git a/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php b/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php
index 40ab4400d0..d5fbcf2b49 100644
--- a/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php
+++ b/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php
@@ -1,85 +1,78 @@
<?php
final class DifferentialBranchFieldSpecification
extends DifferentialFieldSpecification {
public function shouldAppearOnRevisionView() {
return true;
}
public function renderLabelForRevisionView() {
return 'Branch:';
}
private function getBranchOrBookmarkDescription(DifferentialDiff $diff) {
$branch = $diff->getBranch();
$bookmark = $diff->getBookmark();
$has_branch = ($branch != '');
$has_bookmark = ($bookmark != '');
if ($has_branch && $has_bookmark) {
return "{$bookmark} bookmark on {$branch} branch";
} else if ($has_bookmark) {
return "{$bookmark} bookmark";
} else if ($has_branch) {
return $branch;
}
return null;
}
public function renderValueForRevisionView() {
$diff = $this->getManualDiff();
return $this->getBranchOrBookmarkDescription($diff);
}
public function renderValueForMail($phase) {
- $status = $this->getRevision()->getStatus();
-
- if ($status != ArcanistDifferentialRevisionStatus::NEEDS_REVISION &&
- $status != ArcanistDifferentialRevisionStatus::ACCEPTED) {
- return null;
- }
-
$diff = $this->getRevision()->loadActiveDiff();
if ($diff) {
$description = $this->getBranchOrBookmarkDescription($diff);
if ($description) {
return "BRANCH\n {$description}";
}
}
return null;
}
public function didWriteRevision(DifferentialRevisionEditor $editor) {
$maniphest = 'PhabricatorApplicationManiphest';
if (!PhabricatorApplication::isClassInstalled($maniphest)) {
return;
}
$branch = $this->getDiff()->getBranch();
$match = null;
if (preg_match('/^T(\d+)/i', $branch, $match)) { // No $ to allow T123_demo.
list(, $task_id) = $match;
$task = id(new ManiphestTaskQuery())
->setViewer($editor->requireActor())
->withIDs(array($task_id))
->executeOne();
if ($task) {
id(new PhabricatorEdgeEditor())
->setActor($this->getUser())
->addEdge(
$this->getRevision()->getPHID(),
PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK,
$task->getPHID())
->save();
}
}
}
public function getCommitMessageTips() {
return array(
'Name branch "T123" to attach the diff to a task.',
);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Sep 20, 6:24 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
241491
Default Alt Text
(4 KB)

Event Timeline