package: viewvc
version: 1.0.3-2
tags: patch

The following output breaks the annotation output:

==
webslinger:/# svn blame file:///svn/code/trunk/Makefile
...
    58       adam       @ant jar
    58       adam       @mkdir -p $(@D)
    58       adam       @touch $@
    58       adam
  1163 [EMAIL PROTECTED] launch      = $(JAVA) $(PROFILE) -classpath
build/lib/webslinger-launcher.jar:lib/gnu-getopt-1.0.11.jar
org.webslinger.launcher.Main -R $(CURDIR) -L svn
  1163 [EMAIL PROTECTED] run = $(launch) run
  1163 [EMAIL PROTECTED] test        = $(launch) test
   927 [EMAIL PROTECTED]
...
==

Note how the names used are longer than 10 characters.  The internal
parsing code used by viewvc doesn't handle this, as it takes the first
17 characters of the line first, before parsing the revision number and
username.  However, when the revision is large and/or username is large,
the output is not nicely formatted into columns, and the parsing code break.

The attached patch fixes this, but changing the regex to work correctly,
and removing the hard-coded split at 17 characters.
--- __init__.py.orig	2007-07-22 20:34:46.335678893 -0500
+++ __init__.py	2007-07-22 20:34:26.285678000 -0500
@@ -482,7 +482,7 @@
     return self._eof
 
 
-_re_blameinfo = re.compile(r"\s*(\d+)\s*(.*)")
+_re_blameinfo = re.compile(r"\s*(\d+)\s*(.*?)\s(.*)")
 
 class BlameSource:
   def __init__(self, svn_client_path, rootpath, fs_path, rev, first_rev):
@@ -514,12 +514,11 @@
     line = self.fp.readline()
     if not line:
       raise IndexError("No more annotations")
-    m = _re_blameinfo.match(line[:17])
+    m = _re_blameinfo.match(line)
     if not m:
       raise vclib.Error("Could not parse blame output at line %i\n%s"
                         % (idx+1, line))
-    rev, author = m.groups()
-    text = line[18:]
+    rev, author, text = m.groups()
     rev = int(rev)
     prev_rev = None
     if rev > self.first_rev:

Reply via email to