[Svnmerge] Patch for log message indentation

Giovanni Bajo rasky at develer.com
Tue Feb 28 00:52:06 PST 2006


Raman Gupta <rocketraman at fastmail.fm> wrote:

> In Alan Barrett's message found here [1], he provided a patch for
> indenting the log messages from the merge head.
>
> [1]
> http://www.orcaware.com/pipermail/svnmerge/2006-February/000225.html
>
> Personally, I also find the indented style much easier to read and
> would like to see his patch committed. If there is some opposition to
> this, then we can always add a --logindent=n option, where n defaults
> to 0.


Fine by me. I don't think it's worth an additional command line option.


>> +#LOG_LINE_PREFIX = ''
>> +LOG_LINE_PREFIX = 2 * ' '

Don't keep a commented line around.


>> +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."""
>> +	result = ""
>> +	for line in lines.split("\n"):
>> +		result = result + prefix + line + "\n"
>> +	return result

The referenced patch concatenates strings in quadratic time using repeated
"operator +". A faster version would be:

return "\n".join([prefix + L for L in lines])

Giovanni Bajo




More information about the Svnmerge mailing list