[viewvc-dev] [PATCH] fix exception on mixing url-based and filesystem-based svn repositories

Harald Karner <[email protected]> Wed, 06 May 2009 18:01:55 +0200
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Message-ID <[email protected]>
Hi,

when I mix svn repositories that are url-based with filesystem-based 
ones in my viewvc.conf, I get an exception on switching to browsing the 
filesys-based repository.

System configuration:
python 2.5.1
ViewVC 1.0.8

viewvc.conf (excerpt):

svn_roots = url_based: https://server/svn/repo,
             filesys_based: /home/user/whatever/svnrepo
default_root = url_based


The exception in the browser:

An Exception Has Occurred
Python Traceback

Traceback (most recent call last):
   File "/home/hka/workspace/viewvc-1.0.8/lib/viewvc.py", line 3753, in main
     request.run_viewvc()
   File "/home/hka/workspace/viewvc-1.0.8/lib/viewvc.py", line 268, in 
run_viewvc
     cfg.general.svn_path)
TypeError: __init__() takes exactly 3 arguments (4 given)



The attached patch fixes this behavior.

regards,
Harald Karner

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2082212

To unsubscribe from this discussion, e-mail: [[email protected]].
bugfix.patch (text/plain, 1 KB)
diff --git a/lib/viewvc.py b/lib/viewvc.py
--- a/lib/viewvc.py
+++ b/lib/viewvc.py
@@ -44,6 +44,8 @@ import popen
 import ezt
 import accept
 import vclib
+import vclib.svn as vclib_svn
+import vclib.svn_ra as vclib_svn_ra
 
 try:
   import idiff
@@ -256,13 +258,12 @@ class Request:
           if re.match(_re_rewrite_url, self.rootpath):
             # If the rootpath is a URL, we'll use the svn_ra module, but
             # lie about its name.
-            import vclib.svn_ra
-            vclib.svn = vclib.svn_ra
+            vclib.svn = vclib_svn_ra
             self.repos = vclib.svn.SubversionRepository(self.rootname,
                                                         self.rootpath)
           else:
             self.rootpath = os.path.normpath(self.rootpath)
-            import vclib.svn
+            vclib.svn = vclib_svn
             self.repos = vclib.svn.SubversionRepository(self.rootname,
                                                         self.rootpath,
                                                         cfg.general.svn_path)