Index: versioncontrol_project.metrics.inc
===================================================================
RCS file: versioncontrol_project.metrics.inc
diff -N versioncontrol_project.metrics.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ versioncontrol_project.metrics.inc	10 Dec 2007 16:37:26 -0000
@@ -0,0 +1,44 @@
+<?php
+// $Id$
+/**
+ * @file
+ * Integrates versioncontrol_project with the metrics module, providing node metrics based
+ * upon VCS data.
+ */
+
+function versioncontrol_project_metrics_functions() {
+  return array(
+    'versioncontrol_project_lines_changed',
+  );
+}
+
+function versioncontrol_project_lines_changed($op, $options = NULL, $node = NULL) {
+  switch ($op) {
+    case 'info':
+      return array(
+        'name' => t('Version Control: Total lines changed'),
+        'description' => t("Returns the number of lines that were changed in the project's VCS commits in the last week"),
+      );
+
+    case 'compute':
+      $constraints = array(
+        'date_lower' => time() - (60 * 60 * 24 * 7),
+      );
+      $constraints = versioncontrol_project_get_commit_constraints($constraints, array('nids' => array($node->nid)));
+      $commits = versioncontrol_get_commits($constraints);
+      $count = 0;
+      foreach ($commits as $key => $commit) {
+        $statistics = versioncontrol_get_commit_statistics($commit);
+        $count += $statistics['lines_added'];
+        $count += $statistics['lines_removed'];
+      }
+      
+      return array(
+        'value' => $count, 
+        'description' => format_plural($count, '1 line of code changed.', '@count lines of code changed.'),
+      );
+
+    case 'options':
+      return array();
+  }
+}
Index: versioncontrol_project.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/versioncontrol_project/versioncontrol_project.module,v
retrieving revision 1.49
diff -u -p -r1.49 versioncontrol_project.module
--- versioncontrol_project.module	9 Nov 2007 23:08:29 -0000	1.49
+++ versioncontrol_project.module	10 Dec 2007 16:37:28 -0000
@@ -9,6 +9,8 @@
  * Copyright 2007 by Jakob Petsovits ("jpetso", http://drupal.org/user/56020)
  */
 
+include_once(drupal_get_path('module', 'versioncontrol_project') .'/versioncontrol_project.metrics.inc');
+ 
 /**
  * Implementation of hook_menu().
  */
