diff options
author | Simone Rota <sip@crux.nu> | 2006-10-18 18:51:26 +0200 |
---|---|---|
committer | Simone Rota <sip@crux.nu> | 2006-10-18 18:51:26 +0200 |
commit | 986d989628605a9a9ec05acf30f606dc9b862621 (patch) | |
tree | 2890dee0551dfe3e1abfeff02c9f0a3366255caa | |
parent | f44d539dadc36d9dd280819c4b22a2b03aeda35e (diff) | |
download | webtools-986d989628605a9a9ec05acf30f606dc9b862621.tar.gz webtools-986d989628605a9a9ec05acf30f606dc9b862621.tar.xz |
timeline: removed svn caching, made git branch selection more flexible
-rwxr-xr-x | timeline/tlcacher.php | 91 |
1 files changed, 12 insertions, 79 deletions
diff --git a/timeline/tlcacher.php b/timeline/tlcacher.php index 69dd30f..24db441 100755 --- a/timeline/tlcacher.php +++ b/timeline/tlcacher.php @@ -15,42 +15,13 @@ require_once("tlcacher_config.php"); // Url of the detailed task $task_url="https://crux.nu/bugs/?do=details&id=%s"; -// Path of the subversion repository -$repo_path = "/home/crux/repo"; - -// Subversion commands -$svn_cmd = "/usr/bin/svn --non-interactive --config-dir /"; -$svnlook_cmd = "/usr/bin/svnlook"; - -// Url of the online repo viewer -$svn_url = "http://crux.nu/svnweb/CRUX/revision/?rev=%s"; // Gitweb url for commits $git_url = "http://crux.nu/gitweb/?p=%s.git;a=commitdiff;h=%s"; -// append "*" to the repo name to restrict logs to $crux_version -$git_repos = array("core","opt","webtools"); -$crux_version = "2.2"; +// append ":branch" to the repo name to restrict logs to 'branch' +$git_repos = array("core:2.2","opt:2.2","xorg:2.2", "pkgutils", "prt-get", "prt-utils"); $git_root = "/home/crux/scm"; - -// Path of the recent changes pmwiki file -$wiki_file = "/home/crux/public_html/wiki.d/Site.AllRecentChanges"; - -// Map svn users to wiki profiles -$username_map = array( - "jaeger" => "jaeger", - "jue" => "JuergenDaubert", - "jw" => "JohannesWinkelmann", - "sip" => "SimoneRota" , - "jdolan" => "JasonThomasDolan", - "jheino" => "JukkaHeino", - "tilman" => "TilmanSauerbeck", - "viper" => "SimonGloßner", - "sten" => "NickSteeves", - "falk" => "FalkHamann", - "aon" => "AnttiNykänen", -); - // Map git authors to wiki profiles $git_username_map = array( "Per Lidén" => "PerLiden", @@ -65,6 +36,10 @@ $git_username_map = array( "Nick Steeves" => "NickSteeves", "Antti Nykänen" => "AnttiNykänen", ); + +// Path of the recent changes pmwiki file +$wiki_file = "/home/crux/public_html/wiki.d/Site.AllRecentChanges"; + // Event: cache_id, tstamp, type(icon), date, time, user, url, description, notes $events = array(); @@ -73,15 +48,6 @@ $events = array(); $dbc =& DB::connect($dsnc); if (DB::isError($dbc)) die("Cannot connect to S database"); $dbc->setFetchMode(DB_FETCHMODE_ASSOC); -$last_cached_sql = "select cache_id from events where event_type='svn_commit' order by cache_id desc"; -$res =& $dbc->limitQuery($last_cached_sql,0,1); -if (DB::isError($res)) die("Query error"); -if ($res->numRows() === 0) { - $last_svn = 0; -} else { - $row =& $res->fetchRow(); - $last_svn = $row['cache_id']; -} $last_cached_sql = "select cache_id from events where event_type like 'task%' order by cache_id desc"; $res =& $dbc->limitQuery($last_cached_sql,0,1); if (DB::isError($res)) die("Query error"); @@ -180,41 +146,6 @@ while ($row =& $res->fetchRow()) { } } - -/**************** Subversion events ********************/ -$out = array(); -$res = 0; -exec("$svnlook_cmd youngest $repo_path", $out, $res); -$svn_latest = trim($out[0]); -if ($svn_latest != $last_svn) { - $last_svn++; - exec("$svn_cmd log file://$repo_path -r$last_svn:HEAD", $out, $res); - foreach ($out as $line) { - if ($line != "" && substr($line, 0, 5) != "-----") { - $revline = split("\|", $line); - if (count($revline) == 4) { - $rev = substr(trim($revline[0]),1); - $user = trim($revline[1]); - if (array_key_exists($user, $username_map)) { - $wikiname = $username_map[$user]; - $user = "[[~" . $wikiname . "|" . $user . "]]"; - } - $date = substr($revline[2],1,10); - $time = substr($revline[2],12,5); - $url = sprintf($svn_url, $rev); - $revurl = "[[$url|$rev]]"; - $description = "Revision $revurl committed by $user"; - $tstamp = strtotime("$date $time:00"); - } else { - $icon = "svn_commit"; - $notes = trim($line); - $events[] = array( 'cache_id' => $rev, 'tstamp' => $tstamp, 'icon' => $icon, 'date' => $date, - 'time' => $time, 'user' => $user, 'url'=>$url, 'description' => $description, 'notes' => $notes); - } - } - } -} - /****************** PmWiki events *********************/ $lines = file($wiki_file); $chline = ""; @@ -256,14 +187,16 @@ if ($chline != "") { /******************* Git events ***********************/ foreach ($git_repos as $repo) { - $last_git = last_cached_git(str_replace('*',"", $repo)); $branch = ""; + if (strpos($repo, ":") !== FALSE) { + $tmp = explode(':', $repo); + $repo = $tmp[0]; + $branch = $tmp[1]; + } + $last_git = last_cached_git($repo); $out = array(); $res = 0; $done = array(); - if (strpos('*', $repo) !== FALSE) - $branch = $crux_version; - $repo = str_replace('*', '', $repo); exec("GIT_DIR=$git_root/$repo.git git log -n 1 $branch", $out, $res); $git_latest = trim(str_replace("commit ", "", $out[0])); unset($out); |