protected function executeQuery() { $drequest = $this->getRequest(); $repository = $drequest->getRepository(); // We need to add 1 in case we pick up HEAD. $count = $this->getOffset() + $this->getLimit() + 1; list($stdout) = $repository->execxLocalCommand('for-each-ref %C --sort=-creatordate --format=%s refs/remotes', $count ? '--count=' . (int) $count : null, '%(refname:short) %(objectname)'); $branch_list = self::parseGitRemoteBranchOutput($stdout, $only_this_remote = DiffusionBranchInformation::DEFAULT_GIT_REMOTE); $branches = array(); foreach ($branch_list as $name => $head) { if (!$repository->shouldTrackBranch($name)) { continue; } $branch = new DiffusionBranchInformation(); $branch->setName($name); $branch->setHeadCommitIdentifier($head); $branches[] = $branch; } $offset = $this->getOffset(); if ($offset) { $branches = array_slice($branches, $offset); } // We might have too many even after offset slicing, if there was no HEAD // for some reason. $limit = $this->getLimit(); if ($limit) { $branches = array_slice($branches, 0, $limit); } return $branches; }
protected function executeQuery() { $drequest = $this->getRequest(); $repository = $drequest->getRepository(); list($stdout) = $repository->execxLocalCommand('branches'); $branch_info = ArcanistMercurialParser::parseMercurialBranches($stdout); $branches = array(); foreach ($branch_info as $name => $info) { $branch = new DiffusionBranchInformation(); $branch->setName($name); $branch->setHeadCommitIdentifier($info['rev']); $branches[] = $branch; } return $branches; }
protected function executeQuery() { $drequest = $this->getRequest(); $repository = $drequest->getRepository(); $local_path = $repository->getDetail('local-path'); list($stdout) = execx('(cd %s && git branch -r --verbose --no-abbrev)', $local_path); $branches = array(); foreach (self::parseGitRemoteBranchOutput($stdout) as $name => $head) { $branch = new DiffusionBranchInformation(); $branch->setName($name); $branch->setHeadCommitIdentifier($head); $branches[] = $branch; } return $branches; }
protected function executeQuery() { $drequest = $this->getRequest(); $repository = $drequest->getRepository(); $local_path = $repository->getDetail('local-path'); list($stdout) = $repository->execxLocalCommand('branch -r --verbose --no-abbrev'); $branch_list = self::parseGitRemoteBranchOutput($stdout, $only_this_remote = DiffusionBranchInformation::DEFAULT_GIT_REMOTE); $branches = array(); foreach ($branch_list as $name => $head) { if (!$repository->shouldTrackBranch($name)) { continue; } $branch = new DiffusionBranchInformation(); $branch->setName($name); $branch->setHeadCommitIdentifier($head); $branches[] = $branch; } return $branches; }