[Svnmerge] [PATCH] Indented log patch modified v2
Blair Zajac
blair at orcaware.com
Tue Feb 28 21:48:51 PST 2006
On Feb 28, 2006, at 8:05 PM, Raman Gupta wrote:
> Attached is a modified version of Alan Barrett's patch for indented
> log
> entries for the commit log message. It takes into account some
> feedback
> from Giovanni related to performance, and also fixes the problem
> brought
> up by Alan himself regarding extra lines.
>
> Note that I have removed the logic for making the log separator longer
> depending on the longest previous separator. I find this is
> unnecessary
> when indenting is used.
>
> Here is a candidate commit log message:
>
> Indent the merged revisions' log messages when creating the commit log
> message after executing svn merge. Removed the previous
> functionality of
> creating a log separator that is longer than the longest previous
> separator. Indenting the log message is clear on its own because each
> nested merge will be indented one additional level.
>
> Patch by: Alan Barrett <apb at cequrux.com>
> Reviewed by: Giovanni Bajo <rasky at develer.com>
> Tweaked by: Raman Gupta <rocketraman at fastmail.fm>
>
> * contrib/client-side/svnmerge.py
> (prefix_lines):
> New method to take a string and prepend each line of the string
> with a specified string. The lines are delimited by newlines
> characters.
> (construct_merged_log_message):
> Removed old mechanism of making the log separator longer for
> nested merge log messages. Added indentation for each commit
> log message. Added check for empty log messages, which should
> never happen but doesn't hurt.
>
> Cheers,
> Raman Gupta
>
> Index: svnmerge.py
> ===================================================================
> --- svnmerge.py (revision 18650)
> +++ svnmerge.py (working copy)
> @@ -65,9 +65,10 @@
> # svnmerge.py will have one more LOG_SEPARATOR appended to the
> longest
> # separator found in all the commits.
> LOG_SEPARATOR = 8 * '.'
> -LOG_SEPARATOR_RE = re.compile('^((%s)+)' % re.escape(LOG_SEPARATOR),
> - re.MULTILINE)
>
> +# Each line of the embedded log messages will be prefixed by
> LOG_LINE_PREFIX.
> +LOG_LINE_PREFIX = 2 * ' '
> +
> # We expect non-localized output from SVN
> os.environ["LC_MESSAGES"] = "C"
>
> @@ -179,6 +180,16 @@
> if opts["verbose"]:
> print "%s: %s" % (NAME, s)
>
> +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")])
Isn't this a list comprehensions that isn't supported by older
Pythons? svnmerge.py goes to great lengths to support older versions.
Regards,
Blair
More information about the Svnmerge
mailing list