Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F22948293
ArcanistDifferentialDependencyGraph.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
1 KB
Subscribers
None
ArcanistDifferentialDependencyGraph.php
View Options
<?php
final
class
ArcanistDifferentialDependencyGraph
extends
AbstractDirectedGraph
{
private
$repositoryAPI
;
private
$conduit
;
private
$startPHID
;
public
function
setStartPHID
(
$start_phid
)
{
$this
->
startPHID
=
$start_phid
;
return
$this
;
}
public
function
getStartPHID
()
{
return
$this
->
startPHID
;
}
public
function
setRepositoryAPI
(
ArcanistRepositoryAPI
$repository_api
)
{
$this
->
repositoryAPI
=
$repository_api
;
return
$this
;
}
public
function
getRepositoryAPI
()
{
return
$this
->
repositoryAPI
;
}
public
function
setConduit
(
ConduitClient
$conduit
)
{
$this
->
conduit
=
$conduit
;
return
$this
;
}
public
function
getConduit
()
{
return
$this
->
conduit
;
}
protected
function
loadEdges
(
array
$nodes
)
{
$repository_api
=
$this
->
getRepositoryAPI
();
$dependencies
=
$this
->
getConduit
()->
callMethodSynchronous
(
'differential.query'
,
array
(
'phids'
=>
$nodes
,
));
$edges
=
array
();
foreach
(
$dependencies
as
$dependency
)
{
$dependency_revision
=
$this
->
getCommitHashFromDict
(
$dependency
);
if
(
$repository_api
->
hasLocalCommit
(
$dependency_revision
))
{
$edges
[
$dependency
[
'phid'
]]
=
array
();
continue
;
}
$auxillary
=
idx
(
$dependency
,
'auxiliary'
,
array
());
$edges
[
$dependency
[
'phid'
]]
=
idx
(
$auxillary
,
'phabricator:depends-on'
,
array
());
}
return
$edges
;
}
private
function
getCommitHashFromDict
(
$dict
)
{
$api
=
$this
->
getRepositoryAPI
();
$hashes
=
idx
(
$dict
,
'hashes'
,
array
());
if
(
$api
instanceof
ArcanistGitAPI
)
{
$key
=
ArcanistDifferentialRevisionHash
::
HASH_GIT_COMMIT
;
}
else
if
(
$api
instanceof
ArcanistMercurialAPI
)
{
$key
=
ArcanistDifferentialRevisionHash
::
HASH_MERCURIAL_COMMIT
;
}
else
{
$key
=
null
;
}
return
idx
(
$hashes
,
$key
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 10, 9:08 AM (15 h, 7 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
da/6b/42ad5d32b49919f852540e1b057b
Attached To
rARC Arcanist
Event Timeline
Log In to Comment