diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-09-19 19:00:35 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-09-19 19:00:35 +0200 |
| commit | 1797cbc2b010552b54e9d070820fa9cbc9ce3af9 (patch) | |
| tree | f4ac239f23e5cdccd75e4ec514abedbd582f4333 /src/phorkie/Repository.php | |
| parent | 63575a005e8e2386abb24e97791e18d61e6350fe (diff) | |
| parent | 149e039741f94f9e22bd2c8d7dcf33158a110e79 (diff) | |
| download | phorkie-1797cbc2b010552b54e9d070820fa9cbc9ce3af9.tar.gz phorkie-1797cbc2b010552b54e9d070820fa9cbc9ce3af9.zip | |
Merge branch 'master' into remotefork
Diffstat (limited to 'src/phorkie/Repository.php')
| -rw-r--r-- | src/phorkie/Repository.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/phorkie/Repository.php b/src/phorkie/Repository.php index 46b2f65..43f2b23 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,28 @@ class Repository $this->hash = $output; } + /** + * Populates $this->message + * + * @return void + */ + 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)) { |
