? 369262_views_support-5.patch
? 369262_views_support.patch
? versioncontrol-views-0.patch
Index: versioncontrol.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/versioncontrol/versioncontrol.module,v
retrieving revision 1.152
diff -u -p -r1.152 versioncontrol.module
--- versioncontrol.module	21 Jun 2009 15:33:07 -0000	1.152
+++ versioncontrol.module	19 Nov 2009 01:36:56 -0000
@@ -121,6 +121,9 @@ define('VERSIONCONTROL_FORM_CREATE', FAL
 function versioncontrol_init() {
   // The backend-only part of the API.
   module_load_include('inc', 'versioncontrol', 'versioncontrol-backend');
+  
+  // Views integration
+  module_load_include('inc', 'versioncontrol', 'includes/versioncontrol.views');
 }
 
 /**
Index: includes/versioncontrol.views.inc
===================================================================
RCS file: includes/versioncontrol.views.inc
diff -N includes/versioncontrol.views.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ includes/versioncontrol.views.inc	19 Nov 2009 01:36:56 -0000
@@ -0,0 +1,177 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Views implementation for Version Control API
+ */
+
+function versioncontrol_views_data() {
+
+  // =========================================================================
+  // versioncontrol_operations
+
+  $data['versioncontrol_operations']['table']['group'] = t('Version Control');
+
+  $data['versioncontrol_operations']['table']['base'] = array(
+    'field' => 'vc_op_id',
+    'title' => t('Version Control Operations'),
+    'help' => t("Commits to all active repositories"),
+  );
+
+  $data['versioncontrol_operations']['message'] = array(
+    'title' => t('Message'),
+    'help' => t('The commit log message.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+  $data['versioncontrol_operations']['username'] = array(
+    'title' => t('VCS Username'),
+    'help' => t('The VCS username responsible for this commit.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+  $data['versioncontrol_operations']['date'] = array(
+    'title' => t('Date'),
+    'help' => t('The date this commit occurred.'),
+    'field' => array(
+      'handler' => 'views_handler_field_date',
+      'click sortable' => TRUE,
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort_date',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_date',
+    ),
+  );
+  $data['versioncontrol_operations']['revision'] = array(
+    'title' => t('Revision'),
+    'help' => t('The revision identifier of this commit.'),
+    'field' => array(
+      'handler' => 'versioncontrol_views_handler_field_revision',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // =========================================================================
+  // versioncontrol_repositories
+
+  $data['versioncontrol_repositories']['table']['group'] = t('Version Control');
+
+  $data['versioncontrol_repositories']['table']['join'] = array(
+    'versioncontrol_operations' => array(
+      'left_field' => 'repo_id',
+      'field' => 'repo_id',
+    ),
+  );
+
+  $data['versioncontrol_repositories']['name'] = array(
+    'title' => t('Repository'),
+    'help' => t('The name of the Version Control Repository in which this commit happened.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  $data['versioncontrol_repositories']['vcs'] = array(
+    'title' => t('VCS'),
+    'help' => t('The name of the Version Control System used by the repository in which this commit happened.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // =========================================================================
+  // versioncontrol_accounts
+
+  $data['versioncontrol_accounts']['table']['group'] = t('Version Control');
+
+  $data['versioncontrol_accounts']['table']['join'] = array(
+    'versioncontrol_operations' => array(
+      'left_field' => 'username',
+      'field' => 'username',
+      'extra' => 'versioncontrol_operations.repo_id = versioncontrol_accounts.repo_id',
+    ),
+  );
+
+  $data['versioncontrol_accounts']['uid'] = array(
+    'title' => t('User'),
+    'help' => t("The User matching the commit's author."),
+    'relationship' => array(
+      'base' => 'users',
+      'field' => 'uid',
+      'handler' => 'views_handler_relationship',
+      'label' => t('User'),
+    ),
+  );
+
+  // =========================================================================
+  // versioncontrol_item_revisions
+
+  $data['versioncontrol_item_revisions']['table']['group'] = t('Version Control');
+
+  $data['versioncontrol_item_revisions']['table']['join'] = array(
+    'versioncontrol_operations' => array(
+      'left_field' => 'revision',
+      'field' => 'revision',
+      'extra' => 'versioncontrol_operations.repo_id = versioncontrol_item_revisions.repo_id',
+    ),
+  );
+
+  return $data;
+}
+
+
+function versioncontrol_views_handlers() {
+  return array(
+    'info' => array(
+      'path' => drupal_get_path('module', 'versioncontrol') .'/includes',
+    ),
+    'handlers' => array(
+      'versioncontrol_views_handler_field_revision' => array(
+        'parent' => 'views_handler_field',
+      ),
+    ),
+  );
+}
Index: includes/versioncontrol_views_handler_field_revision.inc
===================================================================
RCS file: includes/versioncontrol_views_handler_field_revision.inc
diff -N includes/versioncontrol_views_handler_field_revision.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ includes/versioncontrol_views_handler_field_revision.inc	19 Nov 2009 01:36:56 -0000
@@ -0,0 +1,21 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Version Control API Views Handler: Field "Revision"
+ */
+
+class versioncontrol_views_handler_field_revision extends views_handler_field {
+  function render_link($data, $values) {
+    $title = versioncontrol_format_revision_identifier($data);
+    if (module_exists('commitlog') && user_access('access commit messages')) {
+      return l($title, 'commitlog', array('query' => array('id' => $values->vc_op_id)));
+    }
+    return $title;
+  }
+
+  function render($values) {
+    return $this->render_link(check_plain($values->{$this->field_alias}), $values);
+  }
+}
