[viewvc-users] Query at top level of a Subversion repository doesn't work in 1.1.0?

John Beranek <[email protected]>
Newsgroups gmane.comp.version-control.cvs.viewcvs.user
Organization John@Home
Message-ID <[email protected]>
I just rebuilt my query database with the new DB format, and then tried 
to do a query at the top level of my Subversion repository.

I set no filters, including Subdirectory, File etc. and asked for all 
commits in the last week.

What I got was an assertion error:

Traceback (most recent call last):
   File "/usr/local/viewvc-1.1.0/lib/viewvc.py", line 4118, in main
     request.run_viewvc()
   File "/usr/local/viewvc-1.1.0/lib/viewvc.py", line 403, in run_viewvc
     self.view_func(self)
   File "/usr/local/viewvc-1.1.0/lib/viewvc.py", line 3875, in view_query
     dir_strip, format)
   File "/usr/local/viewvc-1.1.0/lib/viewvc.py", line 3665, in build_commit
     author=request.server.escape(f.getAuthor()),
AttributeError: LazyCommit instance has no attribute 'getAuthor'


I've now made a few stabs in the dark changes in the code to try to get 
it to work, and can now do a query at the top level, but it looks weird 
- the query now shows commits where file is "/".

For reference I've attached my (probably somewhat amateur) diffs.

John.

-- 
John Beranek                         To generalise is to be an idiot.
http://redux.org.uk/                                 -- William Blake

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

To unsubscribe from this discussion, e-mail: [[email protected]].
diff.txt (text/plain, 2 KB)
--- /root/viewvc-1.1.0/lib/viewvc.py	2009-05-13 14:50:12.000000000 +0100
+++ lib/viewvc.py	2009-06-05 10:16:50.000000000 +0100
@@ -455,11 +455,11 @@
       params = self.query_dict.copy()
     else:
       params = params.copy()
       
     # must specify both where and pathtype or neither
-    assert (where is None) == (pathtype is None)
+#    assert (where is None) == (pathtype is None)
 
     # if we are asking for the revision info view, we don't need any
     # path information
     if (view_func is view_revision or view_func is view_roots
         or view_func is redirect_pathrev):
@@ -3568,10 +3572,14 @@
     if request.roottype == 'svn' and change_type == 'Remove':
       exam_rev = rev_prev
 
     # Check path access (since the commits database logic bypasses the
     # vclib layer and, thus, the vcauth stuff that layer uses).
+
+    if not where:
+      where = ""
+
     path_parts = _path_parts(where)
     if path_parts:
       # Skip files in CVSROOT if asked to hide such.
       if cfg.options.hide_cvsroot \
          and is_cvsroot_path(request.roottype, path_parts):
@@ -3637,14 +3645,26 @@
     
     num_allowed = num_allowed + 1
     if max_files and num_allowed > max_files:
       continue
 
+    try:
+      author = f.getAuthor()
+    except AttributeError:
+      author = ""
+    
+    if not author:
+      author = ""
+    if not dirname:
+      dirname = ""
+    if not filename:
+      filename = ""
+
     commit_files.append(_item(date=commit_time,
                               dir=request.server.escape(dirname),
                               file=request.server.escape(filename),
-                              author=request.server.escape(f.GetAuthor()),
+                              author=request.server.escape(author),
                               rev=rev,
                               branch=f.GetBranch(),
                               plus=plus,
                               minus=minus,
                               type=change_type,
smime.p7s (application/x-pkcs7-signature, 3.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.