Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2983638
ArcanistBrowseCommitHardpointQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
ArcanistBrowseCommitHardpointQuery.php
View Options
<?php
final
class
ArcanistBrowseCommitHardpointQuery
extends
ArcanistRuntimeHardpointQuery
{
public
function
getHardpoints
(
)
{
return
array
(
ArcanistBrowseRef
::
HARDPOINT_COMMITREFS
,
)
;
}
protected
function
canLoadRef
(
ArcanistRef
$ref
)
{
return
(
$ref
instanceof
ArcanistBrowseRef
)
;
}
public
function
loadHardpoint
(
array
$refs
,
$hardpoint
)
{
$api
=
$this
->
getRepositoryAPI
(
)
;
$commit_map
=
array
(
)
;
foreach
(
$refs
as
$key
=>
$ref
)
{
$token
=
$ref
->
getToken
(
)
;
if
(
$token
===
'.'
)
{
// Git resolves "." like HEAD, but we want to treat it as "browse the
// current directory" instead in all cases.
continue
;
}
// Always resolve the empty token; top-level loaders filter out
// irrelevant tokens before this stage.
if
(
$token
===
null
)
{
$token
=
$api
->
getHeadCommit
(
)
;
}
// TODO: We should pull a full commit ref out of the API as soon as it
// is able to provide them. In particular, we currently miss Git tree
// hashes which reduces the accuracy of lookups.
try
{
$commit
=
$api
->
getCanonicalRevisionName
(
$token
)
;
if
(
$commit
)
{
$commit_map
[
$commit
]
[
]
=
$key
;
}
}
catch
(
Exception
$ex
)
{
// Ignore anything we can't resolve.
}
}
if
(
!
$commit_map
)
{
yield
$this
->
yieldMap
(
array
(
)
)
;
}
$results
=
array
(
)
;
foreach
(
$commit_map
as
$commit_identifier
=>
$ref_keys
)
{
foreach
(
$ref_keys
as
$key
)
{
$commit_ref
=
id
(
new
ArcanistCommitRef
(
)
)
->
setCommitHash
(
$commit_identifier
)
;
$results
[
$key
]
[
]
=
$commit_ref
;
}
}
yield
$this
->
yieldMap
(
$results
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Feb 20, 19:40 (2 d, 6 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1116006
Default Alt Text
ArcanistBrowseCommitHardpointQuery.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment