From 161a212cf9a67236ba5310a023c4a04b0dc6f888 Mon Sep 17 00:00:00 2001
From: Marco Villegas <marvil07@gmail.com>
Date: Tue, 10 Aug 2010 18:56:44 -0500
Subject: [PATCH] fix VersioncontrolRepositoryImportExport interface methods.

---
 includes/VersioncontrolRepository.php       |   25 +++++++++++++++++++++----
 includes/interfaces.inc                     |    4 ++--
 versioncontrol_fakevcs/includes/classes.inc |    4 ++--
 3 files changed, 25 insertions(+), 8 deletions(-)

diff --git includes/VersioncontrolRepository.php includes/VersioncontrolRepository.php
index c81ff55..8ca378f 100644
--- includes/VersioncontrolRepository.php
+++ includes/VersioncontrolRepository.php
@@ -366,20 +366,37 @@ abstract class VersioncontrolRepository implements ArrayAccess {
    * Export a repository's authenticated accounts to the version control system's
    * password file format.
    *
-   * @param $repository
-   *   The repository array of the repository whose accounts should be exported.
-   *
    * @return
    *   The plaintext result data which could be written into the password file
    *   as is.
    */
   public function exportAccounts() {
+    if (!$this instanceof VersioncontrolRepositoryImportExport) {
+      return NULL;
+    }
     $accounts = VersioncontrolAccountCache::getInstance()->getAccounts(array(
       'repo_ids' => array($this->repo_id),
     ));
-    return $repository->exportAccounts($accounts);
+    return $this->_exportAccounts($accounts);
   }
 
+  /**
+   * Import accounts to repository.
+   *
+   * @param $data
+   *   The contents of the "account data" text area where the user has to
+   *   enter/copy the contents of the version control system's accounts file.
+   *
+   * @return
+   *   The plaintext result data which could be written into the password file
+   *   as is.
+   */
+  public function importAccounts($data) {
+    if (!$this instanceof VersioncontrolRepositoryImportExport) {
+      return;
+    }
+    $this->_importAccounts($data);
+  }
 
   /**
    * Try to retrieve a given item in a repository.
diff --git includes/interfaces.inc includes/interfaces.inc
index d0e445f..fb3bb0e 100644
--- includes/interfaces.inc
+++ includes/interfaces.inc
@@ -196,7 +196,7 @@ interface VersioncontrolRepositoryImportExport {
    *   The contents of the "account data" text area where the user has to
    *   enter/copy the contents of the version control system's accounts file.
    */
-  public function importAccounts($data);
+  public function _importAccounts($data);
 
   /**
    * Export accounts of a repository to text data that is suitable for
@@ -215,6 +215,6 @@ interface VersioncontrolRepositoryImportExport {
    * @return
    *   The exported textual representation of the account list.
    */
-  public function exportAccounts($accounts);
+  public function _exportAccounts($accounts);
 
 }
diff --git versioncontrol_fakevcs/includes/classes.inc versioncontrol_fakevcs/includes/classes.inc
index 89f8803..b6e0c94 100644
--- versioncontrol_fakevcs/includes/classes.inc
+++ versioncontrol_fakevcs/includes/classes.inc
@@ -66,7 +66,7 @@ class VersioncontrolFakeRepository extends VersioncontrolRepository implements V
     return array('item' => $item, 'selected_label' => NULL);
   }
 
-  public function importAccounts($data) {
+  public function _importAccounts($data) {
     $accounts = $this->parseAccountData($data);
 
     foreach ($accounts as $account) {
@@ -96,7 +96,7 @@ class VersioncontrolFakeRepository extends VersioncontrolRepository implements V
     }
   }
 
-  public function exportAccounts($accounts) {
+  public function _exportAccounts($accounts) {
     if (empty($accounts)) {
       return '# '. t('no user accounts available to export');
     }
-- 
1.7.1

