[Svnmerge] [PATCH] Indented log patch modified v2
Raman Gupta
rocketraman at fastmail.fm
Wed Mar 1 12:40:58 PST 2006
Alan Barrett wrote:
> 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.
The function doesn't really assume anything -- each line that is passed
in will be indented. That includes any zero length lines at the end.
>> - 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.
No, it doesn't. Try it out.
Cheers,
Raman
More information about the Svnmerge
mailing list