Index: cvs.module
===================================================================
--- cvs.module	(revision 641)
+++ cvs.module	(working copy)
@@ -1477,9 +1477,9 @@
     array('data' => t('First commit'), 'field' => 'first_commit'),
     array('data' => t('Commits'), 'field' => 'commits'));
 
-  $result = db_query("SELECT f.uid, u.name, MIN(m.created) AS first_commit, MAX(m.created) AS last_commit, COUNT(f.cid) AS commits FROM {cvs_files} f INNER JOIN {cvs_messages} m ON m.cid = f.cid INNER JOIN {users} u ON f.uid = u.uid WHERE f.uid != %d AND f.nid = %d GROUP BY f.nid, f.uid". tablesort_sql($header), 0, $nid);
-  $rows = array();
-  while ($contributor = db_fetch_object($result)) {
+  $contributors = cvs_get_project_contributors_list($nid, tablesort_sql($header));
+  $rows = array();
+  foreach ($contributors as $contributor) {
     $rows[] = array(
       theme('username', $contributor),
       t('!time ago', array('!time' => format_interval(time() - $contributor->last_commit, 1))),
@@ -1487,8 +1487,31 @@
       format_plural($contributor->commits, '1 commit', '@count commits')
     );
   }
-
   return theme('table', $header, $rows);
+}
+
+/**
+ * Retrieves a list of contributors for the specified project.
+ *
+ * @param $nid
+ *   The project node's nid.
+ * @param $sort
+ *   The SQL sort clause.
+ * @return
+ *   An array containing the project contributors. Each contributor object has following keys:
+ *     uid: the contributor's user id
+ *     name: the contributor's user name
+ *     first_commit: the contributor's first commit timestamp on this project
+ *     last_commit: the contributor's last commit timestamp on this project
+ *     commits: the contributor's commits count on this project
+ */
+function cvs_get_project_contributors_list($nid, $sort) {
+  $result = db_query("SELECT f.uid, u.name, MIN(m.created) AS first_commit, MAX(m.created) AS last_commit, COUNT(f.cid) AS commits FROM {cvs_files} f INNER JOIN {cvs_messages} m ON m.cid = f.cid INNER JOIN {users} u ON f.uid = u.uid WHERE f.uid != %d AND f.nid = %d GROUP BY f.nid, f.uid". $sort, 0, $nid);
+  $contributors = array();
+  while ($contributor = db_fetch_object($result)) {
+    $contributors[] = $contributor;
+  }
+  return $contributors;
 }
 
 /**
