mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-21 22:32:41 +01:00
Give Mercurial more plausible marker behavior
Summary: Ref T13546. Fixes some issues where marker selection in Mercurial didn't work, and selects "draft()" as the set of commits to show, which is at least somewhat reasonable. Test Plan: Ran "arc branches" and "arc bookmarks" in Mercurial, got more reasonable output. Maniphest Tasks: T13546 Differential Revision: https://secure.phabricator.com/D21380
This commit is contained in:
parent
8c95dc0d29
commit
4b8a32ee02
4 changed files with 31 additions and 11 deletions
|
@ -1035,4 +1035,24 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
return new ArcanistMercurialCommitGraphQuery();
|
||||
}
|
||||
|
||||
protected function newPublishedCommitHashes() {
|
||||
$future = $this->newFuture(
|
||||
'log --rev %s --template %s',
|
||||
hgsprintf('parents(draft()) - draft()'),
|
||||
'{node}\n');
|
||||
list($lines) = $future->resolve();
|
||||
|
||||
$lines = phutil_split_lines($lines, false);
|
||||
|
||||
$hashes = array();
|
||||
foreach ($lines as $line) {
|
||||
if (!strlen(trim($line))) {
|
||||
continue;
|
||||
}
|
||||
$hashes[] = $line;
|
||||
}
|
||||
|
||||
return $hashes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,9 +66,9 @@ final class ArcanistMercurialCommitGraphQuery
|
|||
$fields = array(
|
||||
'', // Placeholder for "encoding".
|
||||
'{node}',
|
||||
'{parents}',
|
||||
'{p1node} {p2node}',
|
||||
'{date|rfc822date}',
|
||||
'{description|utf8}',
|
||||
'{desc|utf8}',
|
||||
);
|
||||
|
||||
$template = implode("\2", $fields)."\1";
|
||||
|
@ -123,6 +123,9 @@ final class ArcanistMercurialCommitGraphQuery
|
|||
$graph = $this->getGraph();
|
||||
$lines = $this->queryFuture;
|
||||
$limit = $this->getLimit();
|
||||
|
||||
$no_parent = str_repeat('0', 40);
|
||||
|
||||
while (true) {
|
||||
if (!$lines->valid()) {
|
||||
return false;
|
||||
|
@ -159,9 +162,12 @@ final class ArcanistMercurialCommitGraphQuery
|
|||
|
||||
if (strlen($parents)) {
|
||||
$parents = explode(' ', $parents);
|
||||
|
||||
$parent_nodes = array();
|
||||
foreach ($parents as $parent) {
|
||||
if ($parent === $no_parent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$parent_node = $graph->getNode($parent);
|
||||
if (!$parent_node) {
|
||||
$parent_node = $graph->newNode($parent);
|
||||
|
|
|
@ -60,7 +60,7 @@ EOTEXT
|
|||
'You stand in the middle of a small clearing in the woods.'));
|
||||
|
||||
$now = time();
|
||||
$hour = (int)date('h', $now);
|
||||
$hour = (int)date('G', $now);
|
||||
|
||||
if ($hour >= 5 && $hour <= 7) {
|
||||
$time = pht(
|
||||
|
|
|
@ -16,7 +16,7 @@ abstract class ArcanistMarkersWorkflow
|
|||
->withMarkerTypes(array($marker_type))
|
||||
->execute();
|
||||
|
||||
$tail_hashes = $this->getTailHashes();
|
||||
$tail_hashes = $api->getPublishedCommitHashes();
|
||||
|
||||
$heads = mpull($markers, 'getCommitHash');
|
||||
|
||||
|
@ -32,7 +32,6 @@ abstract class ArcanistMarkersWorkflow
|
|||
}
|
||||
|
||||
$nodes = $query->execute();
|
||||
|
||||
if (count($nodes) > $limit) {
|
||||
|
||||
// TODO: Show what we can.
|
||||
|
@ -168,11 +167,6 @@ abstract class ArcanistMarkersWorkflow
|
|||
return isset($types[$marker_type]);
|
||||
}
|
||||
|
||||
private function getTailHashes() {
|
||||
$api = $this->getRepositoryAPI();
|
||||
return $api->getPublishedCommitHashes();
|
||||
}
|
||||
|
||||
private function sortSets(
|
||||
ArcanistCommitGraph $graph,
|
||||
array $sets,
|
||||
|
|
Loading…
Reference in a new issue