Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9583884
ArcanistBrowseCommitHardpointQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
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
Sat, Oct 11, 11:03 (3 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
984256
Default Alt Text
ArcanistBrowseCommitHardpointQuery.php (1 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline
Log In to Comment