From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carl Worth Subject: [PATCH] Munge ChangeLog-style commit messages, and grab author name and email. Date: Fri, 10 Feb 2006 17:19:13 -0800 Message-ID: <87slqqvgj2.wl%cworth@cworth.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-From: git-owner@vger.kernel.org Sat Feb 11 02:22:23 2006 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F7jQs-00009z-Vu for gcvg-git@gmane.org; Sat, 11 Feb 2006 02:20:20 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932293AbWBKBUJ (ORCPT ); Fri, 10 Feb 2006 20:20:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932294AbWBKBUJ (ORCPT ); Fri, 10 Feb 2006 20:20:09 -0500 Received: from theworths.org ([217.160.253.102]:54187 "EHLO theworths.org") by vger.kernel.org with ESMTP id S932293AbWBKBUI (ORCPT ); Fri, 10 Feb 2006 20:20:08 -0500 Received: (qmail 23582 invoked from network); 10 Feb 2006 20:20:07 -0500 Received: from localhost (HELO raht.localdomain) (127.0.0.1) by localhost with SMTP; 10 Feb 2006 20:20:07 -0500 To: git@vger.kernel.org User-Agent: Wanderlust/2.14.0 (Africa) Emacs/21.4 Mule/5.0 (SAKAKI) Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: The cairo project has been using ChangeLog-style commit messages, such as: 2006-01-18 Carl Worth * src/cairo-pdf-surface.c: (cairo_pdf_surface_create_for_stream), (cairo_pdf_surface_create): Fix compilation-breaking typo. This patch recognizes that style and munges it up into: Fix compilation-breaking typo. which results in a much more useful headline within git. It also grabs the name and email address from the first line and commits with those as GIT_AUTHOR_NAME and GIT_AUTHOR_MAIL. It would probably make sense to hide all this munging behind an appropriate command-line parameter, but I'm offering this up as is in case it's useful for anyone with similar commit messages. Signed-off-by: Carl Worth Signed-off-by: Keith Packard --- git-cvsimport.perl | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 71 insertions(+), 0 deletions(-) 2f2002fe619c45cb1be1c0f063416ede242f3552 diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 00fc3ba..6b63aa2 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -658,6 +658,12 @@ my $commit = sub { } } + # Look for name and email from ChangeLog-style commit message + if ($logmsg =~ /^\s*\d\d\d\d-\d\d-\d\d\s*(.*)\s*<(.*)>/) { + $author_name = $1; + $author_email = $2; + } + exec("env", "GIT_AUTHOR_NAME=$author_name", "GIT_AUTHOR_EMAIL=$author_email", @@ -673,8 +679,73 @@ my $commit = sub { # compatibility with git2cvs substr($logmsg,32767) = "" if length($logmsg) > 32767; + + # We do a bunch of munging on the log message here, + # particularly for logs that are formatted in a ChangeLog + # style. + + my $origlog = $logmsg; + + # Kill initial date/name stamp: YYYY-MM-DD First Last + + $logmsg =~ s|^\s*\d\d*-\d\d*-\d\d*\s*[^<\n]*<[^>\n]*>\s*$|* \n|mg; + + # Strip out nickle version numbers + $logmsg =~ s|^(version )?2.\d\d*$||mg; + + # Remove initial space for each line + $logmsg =~ s|^[ \t]+||mg; + + # Collapse space sequences + $logmsg =~ s|[ \t]+| |g; + + # Un-fold paragraphs + $logmsg =~ s|([^\n])\n([^*+\-\n])|$1 $2|g; + + my @lines = split (/\n/, $logmsg); + + $logmsg = ""; + + my $reviews = ""; + + foreach my $line (@lines) { + # Pull out any reviewed-by name + if ($line =~ /^reviewed by:\s*/i) { + if ($line !~ /