Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97262200
DifferentialBuildableEngine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jan 3, 21:20
Size
2 KB
Mime Type
text/x-php
Expires
Sun, Jan 5, 21:20 (2 d)
Engine
blob
Format
Raw Data
Handle
23368263
Attached To
rPH Phabricator
DifferentialBuildableEngine.php
View Options
<?php
final
class
DifferentialBuildableEngine
extends
HarbormasterBuildableEngine
{
protected
function
getPublishableObject
()
{
$object
=
$this
->
getObject
();
if
(
$object
instanceof
DifferentialDiff
)
{
return
$object
->
getRevision
();
}
return
$object
;
}
public
function
publishBuildable
(
HarbormasterBuildable
$old
,
HarbormasterBuildable
$new
)
{
// If we're publishing to a diff that is not actually attached to a
// revision, we have nothing to publish to, so just bail out.
$revision
=
$this
->
getPublishableObject
();
if
(!
$revision
)
{
return
;
}
// Don't publish manual buildables.
if
(
$new
->
getIsManualBuildable
())
{
return
;
}
// Don't publish anything if the buildable is still building. Differential
// treats more buildables as "building" than Harbormaster does, but the
// Differential definition is a superset of the Harbormaster definition.
if
(
$new
->
isBuilding
())
{
return
;
}
$viewer
=
$this
->
getViewer
();
$old_status
=
$revision
->
getBuildableStatus
(
$new
->
getPHID
());
$new_status
=
$revision
->
newBuildableStatus
(
$viewer
,
$new
->
getPHID
());
if
(
$old_status
===
$new_status
)
{
return
;
}
$buildable_type
=
DifferentialRevisionBuildableTransaction
::
TRANSACTIONTYPE
;
$xaction
=
$this
->
newTransaction
()
->
setMetadataValue
(
'harbormaster:buildablePHID'
,
$new
->
getPHID
())
->
setTransactionType
(
$buildable_type
)
->
setNewValue
(
$new_status
);
$this
->
applyTransactions
(
array
(
$xaction
));
}
public
function
getAuthorIdentity
()
{
$object
=
$this
->
getObject
();
if
(
$object
instanceof
DifferentialRevision
)
{
$object
=
$object
->
loadActiveDiff
();
}
$authorship
=
$object
->
getDiffAuthorshipDict
();
if
(!
isset
(
$authorship
[
'authorName'
]))
{
return
null
;
}
$name
=
$authorship
[
'authorName'
];
$address
=
idx
(
$authorship
,
'authorEmail'
);
$full
=
id
(
new
PhutilEmailAddress
())
->
setDisplayName
(
$name
)
->
setAddress
(
$address
);
return
id
(
new
PhabricatorRepositoryIdentity
())
->
setIdentityName
((
string
)
$full
)
->
makeEphemeral
();
}
}
Event Timeline
Log In to Comment