[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Execute and parse a low-level Mercurial branches query using `hg branches`. 5 */ 6 final class DiffusionLowLevelMercurialBranchesQuery 7 extends DiffusionLowLevelQuery { 8 9 private $contains; 10 11 public function withContainsCommit($commit) { 12 $this->contains = $commit; 13 return $this; 14 } 15 16 protected function executeQuery() { 17 $repository = $this->getRepository(); 18 19 if ($this->contains !== null) { 20 $spec = hgsprintf('(descendants(%s) and head())', $this->contains); 21 } else { 22 $spec = hgsprintf('head()'); 23 } 24 25 list($stdout) = $repository->execxLocalCommand( 26 'log --template %s --rev %s', 27 '{node}\1{branch}\2', 28 $spec); 29 30 $branches = array(); 31 32 $lines = explode("\2", $stdout); 33 $lines = array_filter($lines); 34 foreach ($lines as $line) { 35 list($node, $branch) = explode("\1", $line); 36 $branches[] = id(new DiffusionRepositoryRef()) 37 ->setShortName($branch) 38 ->setCommitIdentifier($node); 39 } 40 41 return $branches; 42 } 43 44 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |