SCM () ; $this->name = 'scmbzr'; $this->text = 'Bazaar'; $this->hooks[] = 'scm_page'; $this->hooks[] = 'scm_admin_update'; $this->hooks[] = 'scm_admin_page'; $this->hooks[] = 'scm_stats'; $this->hooks[] = 'scm_plugin'; $this->hooks[] = 'scm_createrepo'; require_once $gfconfig.'plugins/scmbzr/config.php' ; $this->default_bzr_server = $default_bzr_server ; $this->enabled_by_default = $enabled_by_default ; $this->bzr_root = $bzr_root; $this->register () ; } function getDefaultServer() { return $this->default_bzr_server ; } function CallHook ($hookname, $params) { global $HTML ; switch ($hookname) { case 'scm_page': $group_id = $params['group_id'] ; $this->getPage ($group_id) ; break ; case 'scm_admin_update': $this->AdminUpdate ($params) ; break ; case 'scm_admin_page': $this->getAdminPage ($params) ; break ; case 'scm_stats': $this->getStats ($params) ; break; case 'scm_createrepo': $this->createOrUpdateRepo ($params) ; break; case 'scm_plugin': $scm_plugins=& $params['scm_plugins']; $scm_plugins[]=$this->name; break; default: // Forgot something } } function getPage ($group_id) { global $HTML, $sys_scm_snapshots_path; $project =& group_get_object($group_id); if (!$project || !is_object($project)) { return false; } elseif ($project->isError()) { return false; } if ($project->usesPlugin ($this->name)) { // Bazaar browser links must be displayed if // project enables anonymous Bazaar $displayBzrBrowser = $project->enableAnonSCM(); // Table for summary info print ('
') ;
print _(' Documentation for Bazaar (sometimes referred to as "bzr") is available here. '); // Anonymous Bazaar Instructions if ($project->enableAnonSCM()) { print _("Anonymous Bazaar Access This project's Bazaar repository can be accessed anonymously through HTTP. "); print '';
print _("A list of available branches can be obtained with the following command:") ;
print " ';
print _("To check out one of these branches:") ;
print " Developer Bazaar Access via SSH Only project developers can access the Bazaar branches tree via this method. SSH must be installed on your client machine. Substitute developername with the proper values. Enter your site password when prompted. '); print 'bzr checkout bzr+ssh://'._('developername').'@' . $project->getSCMBox() . '/'. $this->svn_root .'/'. $project->getUnixName().'/'._('branchname').' ' ; // Bazaar Snapshot if ($displaySvnBrowser) { $filename=$project->getUnixName().'-scm-latest.tar.gz'; if (file_exists($sys_scm_snapshots_path.'/'.$filename)) { print '[' ; print util_make_link ("/snapshots.php?group_id=$group_id", _('Download The Nightly Bazaar Tree Snapshot') ) ; print '] '; } } print ' | ' ;
// Bazaar Browsing
echo $HTML->boxTop(_('Repository History'));
echo _('Not implemented yet');
/* echo $this->getDetailedStats(array('group_id'=>$group_id)).' '; if ($displaySvnBrowser) { echo _('Browse the Bazaar Tree Browsing the Bazaar tree gives you a great view into the current status of this project\'s code. You may also view the complete histories of any file in the repository. '); echo '[' ; echo util_make_link ("/scm/viewvc.php/?root=".$project->getUnixName(), _('Browse Bazaar Repository') ) ; echo '] ' ; } */ echo $HTML->boxBottom(); print ' |
c($group->enableAnonSCM()); ?> />
isError()) { return false; } if ($project->usesPlugin ($this->name)) { list($commit_num, $add_num) = $this->getTotalStats($group_id); echo ' (Bazaar: '.sprintf(_('%1$s updates, %2$s adds'), number_format($commit_num, 0), number_format($add_num, 0)).')'; } } // Get the total stats for a group function getTotalStats($group_id) { $result = db_query_params (' SELECT SUM(commits) AS commits, SUM(adds) AS adds FROM stats_cvs_group WHERE group_id=$1', array($group_id)); $commit_num = db_result($result,0,0); $add_num = db_result($result,0,1); if (!$commit_num) { $commit_num=0; } if (!$add_num) { $add_num=0; } return array($commit_num, $add_num); } function getDetailedStats ($params) { global $HTML; $group_id = $params['group_id'] ; $result = db_query(' SELECT u.realname, u.user_name, u.user_id, sum(commits) as commits, sum(adds) as adds, sum(adds+commits) as combined FROM stats_cvs_user s, users u WHERE group_id=\''.$group_id.'\' AND s.user_id=u.user_id AND (commits>0 OR adds >0) GROUP BY group_id, realname, user_name, u.user_id ORDER BY combined DESC, realname; '); if (db_numrows($result) > 0) { $tableHeaders = array( _('Name'), _('Adds'), _('Updates') ); echo $HTML->listTableTop($tableHeaders); $i = 0; $total = array('adds' => 0, 'commits' => 0); while($data = db_fetch_array($result)) { echo '