Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2892990
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/differential/customfield/DifferentialBranchField.php b/src/applications/differential/customfield/DifferentialBranchField.php
index 2387e3cd3f..60291b6be3 100644
--- a/src/applications/differential/customfield/DifferentialBranchField.php
+++ b/src/applications/differential/customfield/DifferentialBranchField.php
@@ -1,97 +1,97 @@
<?php
final class DifferentialBranchField
extends DifferentialCustomField {
public function getFieldKey() {
return 'differential:branch';
}
public function getFieldName() {
return pht('Branch');
}
public function getFieldDescription() {
return pht('Shows the branch a diff came from.');
}
public function shouldAppearInPropertyView() {
return true;
}
public function renderPropertyViewValue(array $handles) {
return null;
}
public function shouldAppearInDiffPropertyView() {
return true;
}
public function renderDiffPropertyViewLabel(DifferentialDiff $diff) {
return $this->getFieldName();
}
public function renderDiffPropertyViewValue(DifferentialDiff $diff) {
return $this->getBranchDescription($diff);
}
private function getBranchDescription(DifferentialDiff $diff) {
- $branch = $diff->getBranch();
- $bookmark = $diff->getBookmark();
+ $branch = coalesce($diff->getBranch(), '');
+ $bookmark = coalesce($diff->getBookmark(), '');
if (strlen($branch) && strlen($bookmark)) {
return pht('%s (bookmark) on %s (branch)', $bookmark, $branch);
} else if (strlen($bookmark)) {
return pht('%s (bookmark)', $bookmark);
} else if (strlen($branch)) {
$onto = $diff->loadTargetBranch();
if (strlen($onto) && ($onto !== $branch)) {
return pht(
'%s (branched from %s)',
$branch,
$onto);
} else {
return $branch;
}
} else {
return null;
}
}
public function getProTips() {
return array(
pht(
'In Git and Mercurial, use a branch like "%s" to automatically '.
'associate changes with the corresponding task.',
'T123'),
);
}
public function shouldAppearInTransactionMail() {
return true;
}
public function updateTransactionMailBody(
PhabricatorMetaMTAMailBody $body,
PhabricatorApplicationTransactionEditor $editor,
array $xactions) {
$revision = $this->getObject();
// Show the "BRANCH" section only if there's a new diff or the revision
// is "Accepted".
$is_update = (bool)$editor->getDiffUpdateTransaction($xactions);
$is_accepted = $revision->isAccepted();
if (!$is_update && !$is_accepted) {
return;
}
$branch = $this->getBranchDescription($revision->getActiveDiff());
if ($branch === null) {
return;
}
$body->addTextSection(pht('BRANCH'), $branch);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 17:40 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127062
Default Alt Text
(2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment