Index: versioncontrol.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/versioncontrol/versioncontrol.admin.inc,v
retrieving revision 1.63
diff -u -p -r1.63 versioncontrol.admin.inc
--- versioncontrol.admin.inc	27 Oct 2010 15:48:03 -0000	1.63
+++ versioncontrol.admin.inc	1 Nov 2010 22:14:20 -0000
@@ -549,71 +549,13 @@ function versioncontrol_admin_account_ex
 function versioncontrol_admin_repository_list(&$form_state) {
   $form = array();
   $backends = versioncontrol_get_backends();
-  $repositories = versioncontrol_repository_load_multiple(FALSE);
-
-  if (empty($repositories)) {
-    $form['empty'] = array(
-      '#value' => '<p>'. t('No repositories are currently known. Please add one or more repositories in order to be able to use version control features on the site.') .'</p>'
-    );
-    return $form;
-  }
-
-  // The header may be modified separately for each VCS,
-  // so this is only a template and still missing the Actions column.
-  $header_template = array(t('Name'), t('Root'));
-
-  // Sort repositories by backend.
-  $repositories_by_backend = array();
-  foreach ($repositories as $repo_id => $repository) {
-    if (!isset($repositories_by_backend[$repository['vcs']])) {
-      $repositories_by_backend[$repository['vcs']] = array();
-    }
-    $repositories_by_backend[$repository['vcs']][$repo_id] = $repository;
-  }
-
-  // Construct the form elements for each VCS separately.
-  foreach ($repositories_by_backend as $vcs => $vcs_repositories) {
-    $header = $header_template;
-    $title = t('@vcs repositories', array('@vcs' => $backends[$vcs]->name));
+  foreach ($backends as $backend) {
+    $title = t('@vcs repositories', array('@vcs' => $backend->name));
     $form[$vcs] = array(
       '#value' => '<h4>'. $title .'</h4>',
     );
-
-    // Add the standard items of each repository - name and root - to the rows.
-    $rows_by_repo_id = array();
-    foreach ($vcs_repositories as $repo_id => $repository) {
-      $rows_by_repo_id[$repo_id] = array(
-        'name' => check_plain($repository['name']),
-        'root' => check_plain($repository['root']),
-      );
-    }
-    // Provide a possibility for backends and other modules to modify the list.
-    // TODO replace with drupal_alter()
-    foreach (module_implements('versioncontrol_alter_repository_list') as $module) {
-      $function = $module .'_versioncontrol_alter_repository_list';
-      $function($vcs, $vcs_repositories, $header, $rows_by_repo_id);
-    }
-    // Add the Actions column as final column, after all the other ones
-    $header[] = array('data' => t('Actions'), 'colspan' => 2);
-    foreach ($rows_by_repo_id as $repo_id => $row) {
-      $links = array(
-        array(
-          'title' => t('Edit'),
-          'href' => 'admin/project/versioncontrol-repositories/edit/'. $repo_id,
-        ),
-        array(
-          'title' => t('Delete'),
-          'href' => 'admin/project/versioncontrol-repositories/delete/'. $repo_id,
-        ),
-      );
-      $rows_by_repo_id[$repo_id]['links'] = theme('links', $links);
-    }
-    // We don't want the repository ids in the final $rows array.
-    $rows = array_values($rows_by_repo_id);
-
-    // The finished table for the currently processed VCS.
-    $form[$vcs]['list'] = array(
-      '#value' => theme('table', $header, $rows) .'<br/>'
+    $form[$vcs . '_repositories'] = array(
+      '#value' => views_embed_view($backend->getViewName('repositories'), 'default', $backend->name),
     );
   }
   return $form;
Index: includes/VersioncontrolBackend.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/versioncontrol/includes/VersioncontrolBackend.php,v
retrieving revision 1.6
diff -u -p -r1.6 VersioncontrolBackend.php
--- includes/VersioncontrolBackend.php	22 Oct 2010 15:55:21 -0000	1.6
+++ includes/VersioncontrolBackend.php	1 Nov 2010 22:14:20 -0000
@@ -44,7 +44,20 @@ abstract class VersioncontrolBackend {
 
   public $classesControllers = array();
 
-  public $controllers = array();
+  /**
+   * An array of the default views for use in the Versioncontorl API interfaces.
+   */
+  public $views = array();
+
+  /**
+   * An array of the update methods available for this backend.
+   *
+   * Currently the keys must pertain to the value of the constants used by the backend.
+   * This undermines the whole purpose of using constants so this should be reworked.
+   *
+   * TODO: Make this not use constants at all?
+   */
+  public $update_methods = array();
 
   public function __construct() {
     // Add defaults to $this->classes
@@ -66,6 +79,16 @@ abstract class VersioncontrolBackend {
       'branch'    => 'VersioncontrolBranch',
       'tag'       => 'VersioncontrolTag',
     );
+    $this->views += array(
+      'repositories' => 'versioncontrol_repositories',
+      'global commit view' => 'versioncontrol_global_commits',
+      'repository commits' => 'versioncontrol_repository_commits',
+      'user commit view' => 'versioncontrol_user_commits',
+    );
+    $this->update_methods += array(
+      0 => t('Automatic log retrieval.'),
+      1 => t('Use external script to insert data.'),
+    );
   }
 
   /**
@@ -135,4 +158,23 @@ abstract class VersioncontrolBackend {
    *   The type of entity being loaded.
    */
   public function augmentEntitySelectQuery($query, $entity_type) {}
+
+  /**
+   * Retrieves the appropriate views module view for this backend.
+   *
+   * Versioncontrol allows backends to customize the views used for the admin
+   * interface.  This method gets the appopriate one for this backend.
+   *
+   * @param $type
+   *   The type of view we are returning (eg. Repositories) 
+   *
+   * @return
+   *   The name of the view to be used.
+   */
+  public function getViewName($type) {
+    if (isset($this->views[$type])) {
+      return $this->views[$type];
+    }
+    return FALSE;
+  }
 }
Index: includes/views/versioncontrol.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/versioncontrol/includes/views/versioncontrol.views.inc,v
retrieving revision 1.2
diff -u -p -r1.2 versioncontrol.views.inc
--- includes/views/versioncontrol.views.inc	22 Oct 2010 20:54:55 -0000	1.2
+++ includes/views/versioncontrol.views.inc	1 Nov 2010 22:14:20 -0000
@@ -76,6 +76,23 @@ function versioncontrol_views_data() {
       'handler' => 'views_handler_argument_string',
     ),
   );
+  $data['versioncontrol_repositories']['update_method'] = array(
+    'title' => t("Update method"),
+    'help' => t("The method by which this repository will be updated."),
+    'field' => array(
+      'handler' => 'versioncontrol_handler_field_repository_update_method',
+      'click sortable' => TRUE,
+    ),
+  );
+
+  $data['versioncontrol_repositories']['actions'] = array(
+    'title' => t("Actions"),
+    'help' => t("Actions that can be performed on a repository."),
+    'field' => array(
+      'handler' => 'versioncontrol_handler_field_repository_actions',
+      'click sortable' => TRUE,
+    ),
+  );
   $data['versioncontrol_repositories']['root'] = array(
     'title' => t("Root Path"),
     'help' => t("The root path to the repository"),
@@ -528,6 +545,12 @@ function versioncontrol_views_handlers()
     ),
     'handlers' => array(
       // field handlers
+      'versioncontrol_handler_field_repository_update_method' => array(
+        'parent' => 'views_handler_field',
+      ),
+      'versioncontrol_handler_field_repository_actions' => array(
+        'parent' => 'views_handler_field',
+      ),
       'versioncontrol_handler_field_operation_type' => array(
         'parent' => 'views_handler_field',
       ),
Index: includes/views/handlers/versioncontrol_handler_field_repository_update_method.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/versioncontrol/includes/views/handlers/versioncontrol_handler_field_repository_update_method.inc,v
retrieving revision 1.1
diff -u -p -r1.1 versioncontrol_handler_field_repository_update_method.inc
--- includes/views/handlers/versioncontrol_handler_field_repository_update_method.inc	20 Oct 2010 18:29:11 -0000	1.1
+++ includes/views/handlers/versioncontrol_handler_field_repository_update_method.inc	1 Nov 2010 22:14:20 -0000
@@ -7,12 +7,20 @@
  */
 class versioncontrol_handler_field_repository_update_method extends views_handler_field {
 
-  function render($values) {
-    $data = unserialize($values->{$this->field_alias});
-    $data_holder = 
-    $data->
+  /**
+   * Called to add the field to a query.
+   */
+  function query() {
+    $this->ensure_my_table();
+    $this->field_alias = $this->query->add_field($this->table_alias, 'update_method');
+    $this->backend_alias = $this->query->add_field($this->table_alias, 'vcs');
+    $this->repo_id_alias = $this->query->add_field($this->table_alias, 'repo_id');
+    $this->add_additional_fields();
+  }
 
-    
-    return $types[$type];
+  function render($values) {
+    $update_methods = versioncontrol_get_backends($values->{$this->backend_alias})->update_methods;
+    // TODO: Add fetch now link!
+    return check_plain($update_methods[$values->{$this->field_alias}]);
   }
 }
