diff options
| author | Justin J. Novack <jnovack@gmail.com> | 2012-09-16 15:17:28 -0400 |
|---|---|---|
| committer | Justin J. Novack <jnovack@gmail.com> | 2012-09-16 15:17:28 -0400 |
| commit | 0845bf175dc416cdf107209fc34f7b37bf42b6e6 (patch) | |
| tree | 9ed5ac3d756b3f0d2f40e35b3bc095a75d968355 | |
| parent | 5935a357efd7be14481b21560347f70116891e16 (diff) | |
| download | phorkie-0845bf175dc416cdf107209fc34f7b37bf42b6e6.tar.gz phorkie-0845bf175dc416cdf107209fc34f7b37bf42b6e6.zip | |
data/templates/revision-head.htm - ADD: display commit message
| -rw-r--r-- | data/templates/revision-head.htm | 1 | ||||
| -rw-r--r-- | src/phorkie/Repository.php | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/data/templates/revision-head.htm b/data/templates/revision-head.htm index 132a68f..a5f7e88 100644 --- a/data/templates/revision-head.htm +++ b/data/templates/revision-head.htm @@ -10,6 +10,7 @@ revision <strong>{{repo.hash}}</strong> </p> <p> + message <strong>{{repo.message}}</strong> </p> </div> <div class="span2"> diff --git a/src/phorkie/Repository.php b/src/phorkie/Repository.php index 448982b..6ed3807 100644 --- a/src/phorkie/Repository.php +++ b/src/phorkie/Repository.php @@ -32,6 +32,12 @@ class Repository */ public $hash; + /** + * Commit message of the last (or current) revision + * + * @var string + */ + public $message; /** @@ -56,6 +62,7 @@ class Repository $this->id = (int)$_GET['id']; $this->loadDirs(); $this->loadHash(); + $this->loadMessage(); } protected function loadDirs() @@ -97,6 +104,23 @@ class Repository $this->hash = $output; } + public function loadMessage() + { + $rev = (isset($this->hash)) ? $this->hash : 'HEAD'; + $output = $this->getVc()->getCommand('log') + ->setOption('oneline') + ->addArgument('-1') + ->addArgument($rev) + ->execute(); + $output = trim($output); + if (strpos($output, ' ') > 0) { + $output = substr($output, strpos($output, ' '), strlen($output)); + $this->message = trim($output); + } else { + $this->message = "This commit message intentionally left blank."; + } + } + public function loadById($id) { if (!is_numeric($id)) { |
