From a84f00afb1cde42f5cb9ba4088f1a9051f774481 Mon Sep 17 00:00:00 2001 From: Manuel Hiebel Date: Sat, 2 Aug 2014 21:45:01 +0200 Subject: switch to git --- rev.php | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'rev.php') diff --git a/rev.php b/rev.php index 2b40a3cfb..00b9a6d7c 100644 --- a/rev.php +++ b/rev.php @@ -15,7 +15,7 @@ $app_root = __DIR__; $vars = array( 'app' => $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'], - 'svn' => get_svn_info($app_root), + 'git' => get_git_info($app_root), 'status' => get_status($app_root), ); @@ -43,30 +43,11 @@ function get_status($app_root) * * @return array */ -function get_svn_info($app_root) +function get_git_info($app_root) { - exec(escapeshellcmd(sprintf('LC_ALL=C %s info %s', exec('which svn'), escapeshellarg($app_root))), + exec(escapeshellcmd(sprintf('LC_ALL=C %s show %s %s', exec('which git'), '-s --pretty="Revision: %H%nLast Author: %an%nDate Revision: %ar%nTitle: %s"', escapeshellarg($app_root))), $out, $ret); - $vars = array(); - $keys = array( - 'URL', - 'Revision', - 'Last Changed Author', - 'Last Changed Rev', - 'Last Changed Date' - ); - foreach ($out as $l) { - $l = explode(':', trim($l)); - $k = trim(array_shift($l)); - if (in_array($k, $keys)) - $vars[strtolower(str_replace(' ', '_', $k))] = trim(implode(':', $l)); - } - // remove scheme & user; keep it? - $u = $vars['url']; - $u = parse_url($u); - $vars['url'] = sprintf('%s%s', $u['host'], $u['path']); - - return $vars; + return $out; } -- cgit v1.2.1