Changeset View
Changeset View
Standalone View
Standalone View
src/ref/commit/ArcanistMercurialCommitSymbolCommitHardpointQuery.php
Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | public function loadHardpoint(array $refs, $hardpoint) { | ||||
// Changeset hashes can be prefixes but also collide with other markers. | // Changeset hashes can be prefixes but also collide with other markers. | ||||
// Consider 'cafe' which could be a bookmark or also a changeset hash | // Consider 'cafe' which could be a bookmark or also a changeset hash | ||||
// prefix. Mercurial will always allow markers to take precedence over | // prefix. Mercurial will always allow markers to take precedence over | ||||
// changeset hashes when resolving, so only populate symbols that match | // changeset hashes when resolving, so only populate symbols that match | ||||
// hashes after all other entries are populated, to avoid the hash taing | // hashes after all other entries are populated, to avoid the hash taing | ||||
// a spot which a marker might match. | // a spot which a marker might match. | ||||
foreach ($node_list as $node) { | foreach ($node_list as $node) { | ||||
foreach ($symbol_set as $symbol) { | foreach ($symbol_set as $symbol) { | ||||
if (str_starts_with($node, $symbol)) { | if (strncmp($node, $symbol, strlen($symbol)) === 0) { | ||||
if (!isset($hash_map[$symbol])) { | if (!isset($hash_map[$symbol])) { | ||||
$hash_map[$symbol] = $node; | $hash_map[$symbol] = $node; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// Remove entries resulting in collisions, which set empty string values | // Remove entries resulting in collisions, which set empty string values | ||||
Show All 34 Lines |