[viewvc-dev] Displaying lock comment

Ennio Zarlenga <[email protected]> Wed, 28 Oct 2009 05:19:33 -0700 (PDT)
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Message-ID <23924979.4013.1256732373479.JavaMail.httpd__48420.1233055957$1256734045$gmane$org@localhost>
Hello,

it seems that there is no easy way to display the lock comments in ViewVC. The attached patch does it in a dirty way, by simply concatenating the lock.owner and the lock.comment strings to create lockinfo.

Would it be possible to have a similar feature (or rather a better one) in future releases?

Thank you,
Ennio
lock_comment2.patch (application/octet-stream, 1.2 KB)
Index: svn_repos.py
===================================================================
--- svn_repos.py	(revision 2278)
+++ svn_repos.py	(working copy)
@@ -463,7 +463,15 @@
       if entry.kind == vclib.FILE:
         entry.size = fs.file_length(fsroot, path)
       lock = fs.get_lock(self.fs_ptr, path)
-      entry.lockinfo = lock and lock.owner or None
+      #entry.lockinfo = lock and lock.owner or None
+      if lock:        
+        if lock.comment:
+          lock_comment = " (" + lock.comment + ")"
+        else:
+          lock_comment = "" 
+        entry.lockinfo = lock.owner + lock_comment
+      else:
+        entry.lockinfo = None
 
   def itemlog(self, path_parts, rev, sortby, first, limit, options):
     """see vclib.Repository.itemlog docstring
@@ -493,8 +501,14 @@
     # See if this path is locked.
     try:
       lock = fs.get_lock(self.fs_ptr, path)
-      if lock:
-        lockinfo = lock.owner
+      if lock:        
+        if lock.comment:
+          lock_comment = " (" + lock.comment + ")"
+        else:
+          lock_comment = "" 
+        lockinfo = lock.owner + lock_comment
+      else:
+        lockinfo = None
     except NameError:
       pass