| */␊ |
| class IDF_Scm_Mercurial extends IDF_Scm␊ |
| {␊ |
| protected $hg_log_template;␊ |
| ␊ |
| public function __construct($repo, $project=null)␊ |
| {␊ |
| $this->repo = $repo;␊ |
| $this->project = $project;␊ |
| $this->hg_log_template = "'".'changeset: {rev}:{node|short}\nauthor: {author}\ndate: {date|isodate}\nfiles: {files}\n{desc}\n'."'";␊ |
| }␊ |
| ␊ |
| public function getRepositorySize()␊ |
|
| if (!$this->isValidRevision($commit)) {␊ |
| return false;␊ |
| }␊ |
| $tmpl = ($getdiff) ?␊ |
| Pluf::f('hg_path', 'hg').' log -p -r %s -R %s' : Pluf::f('hg_path', 'hg').' log -r %s -R %s';␊ |
| $tmpl = ($getdiff)␊ |
| ? Pluf::f('hg_path', 'hg').' log -p -r %s -R %s --template %s'␊ |
| : Pluf::f('hg_path', 'hg').' log -r %s -R %s --template %s';␊ |
| $cmd = sprintf($tmpl,␊ |
| escapeshellarg($commit), escapeshellarg($this->repo));␊ |
| escapeshellarg($commit),␊ |
| escapeshellarg($this->repo),␊ |
| $this->hg_log_template);␊ |
| ␊ |
| $out = array();␊ |
| $cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;␊ |
| self::exec('IDF_Scm_Mercurial::getCommit', $cmd, $out);␊ |
|
| $log[] = $line;␊ |
| }␊ |
| }␊ |
| $out = self::parseLog($log, 6);␊ |
| $out = self::parseLog($log, 4);␊ |
| $out[0]->diff = implode("\n", $change);␊ |
| return $out[0];␊ |
| }␊ |
|
| */␊ |
| public function getChangeLog($commit='tip', $n=10)␊ |
| {␊ |
| $cmd = sprintf(Pluf::f('hg_path', 'hg').' log -R %s -l%s ', escapeshellarg($this->repo), $n, $commit);␊ |
| $cmd = sprintf(Pluf::f('hg_path', 'hg').' log -R %s -l%s --template %s', escapeshellarg($this->repo), $n, $this->hg_log_template, $commit);␊ |
| $out = array();␊ |
| $cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;␊ |
| self::exec('IDF_Scm_Mercurial::getChangeLog', $cmd, $out);␊ |
| return self::parseLog($out, 6);␊ |
| return self::parseLog($out, 4);␊ |
| }␊ |
| ␊ |
| /**␊ |
|
| continue;␊ |
| }␊ |
| $match = array();␊ |
| if (preg_match('/(\S+)\s*:\s*(.*)/', $line, $match)) {␊ |
| if (preg_match('/^(\S+):\s*(.*)/', $line, $match)) {␊ |
| $match[1] = strtolower($match[1]);␊ |
| if ($match[1] == 'user') {␊ |
| $c['author'] = $match[2];␊ |