[Svnmerge] [PATCH] Indented log patch modified v2

Alan Barrett apb at cequrux.com
Wed Mar 1 12:24:21 PST 2006


On Wed, 01 Mar 2006, Raman Gupta wrote:
> Attached v3 of the indent patch.

> +def prefix_lines(prefix, lines):
> +  """Given a string representing lines of text,
> +  insert the specified prefix at the begining of each line,
> +  and return the result."""
> +  
> +  if len(lines) > 0:
> +      return "\n".join([prefix + L for L in lines.split("\n")])
> +  else:
> +      return ""

This function assumes that the last line will not be terminated by "\n".
That assumption should be documented.

> -        for match in LOG_SEPARATOR_RE.findall(message):
> -            sep = match[1]
> -            if len(sep) > len(longest_sep):
> -                longest_sep = sep
> +        if len(message) > 0:
> +            logs.append("\n" + prefix_lines(LOG_LINE_PREFIX, \
                           ^^^^
> +                                            rstrip(message, "\n")) + "\n")
> +            for match in LOG_SEPARATOR_RE.findall(message):
> +                sep = match[1]
> +                if len(sep) > len(longest_sep):
> +                    longest_sep = sep

I haven't run the code, but I think that the "\n" highlighted above will
put an unwanted blank line between the "........" and the first line of
the nested log message.

--apb (Alan Barrett)



More information about the Svnmerge mailing list