[PATCH] git-svn.perl: Strip ChangeLog bits.

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>
Date: Saturday, August 2, 2008 - 9:42 am

Some projects write ChangeLog entries and use those for svn
commit messages.  Converting such a repository makes for
a most uninteresting git log --pretty=oneline output.

    482cfc6... 2008-08-01  Kohei Yoshida  <kyoshida@novell.com>
    90c16d7... 2008-08-01  Fong Lin  <pflin@novell.com> 	* patches/dev300/cws-npow
    505fc23... 2008-08-01  Kohei Yoshida  <kyoshida@novell.com>
    4729379... 2008-08-01  Kohei Yoshida  <kyoshida@novell.com>
    9e34b85... 2008-07-31  Kohei Yoshida  <kyoshida@novell.com>
    ee1855a... 2008-07-31  Jan Nieuwenhuizen  <janneke@gnu.org>
    518b921... 2008-07-31  Miklos Vajna  <vmiklos@frugalware.org>

The --cut-changelog-bits fixes this

    44e7784... patches/dev300/apply: added upstream issue numbers to some of my  p
    1a19026... patches/dev300/cws-npower11.diff: Add vba events stuff.
    7422531... patches/test/calc-external-defined-names.diff: more progress; make 
    66c5975... scratch/sc-xlsutil/src/formula.py:
    307fa53... patches/dev300/chart-subtitle-xls-export.diff: preserve the subtitl
    0d127af... patches/dev300/layout-simple-dialogs-toolkit.diff: Remove duplicate
    843d41e... patches/dev300/apply: Remove gcc401-stlport45-include.diff from Fru

partly.  I tried removing the file name bits too, but that makeslog
entries that touch multiple files almost useless.


Signed-off-by: Jan Nieuwenhuizen <Jan Nieuwenhuizen janneke@gnu.org>
---
 git-svn.perl |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index cf6dbbc..651739a 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -66,7 +66,7 @@ my ($_stdin, $_help, $_edit,
 	$_version, $_fetch_all, $_no_rebase,
 	$_merge, $_strategy, $_dry_run, $_local,
 	$_prefix, $_no_checkout, $_url, $_verbose,
-	$_git_format);
+	$_git_format, $_cut_changelog_bits);
 $Git::SVN::_follow_parent = 1;
 my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
                     'config-dir=s' => \$Git::SVN::Ra::config_dir,
@@ -109,9 +109,11 @@ my %cmd = (
 	fetch => [ \&cmd_fetch, "Download new revisions from SVN",
 			{ 'revision|r=s' => \$_revision,
 			  'fetch-all|all' => \$_fetch_all,
+			  'cut-changelog-bits' => \$_cut_changelog_bits,
 			   %fc_opts } ],
 	clone => [ \&cmd_clone, "Initialize and fetch revisions",
 			{ 'revision|r=s' => \$_revision,
+			  'cut-changelog-bits' => \$_cut_changelog_bits,
 			   %fc_opts, %init_opts } ],
 	init => [ \&cmd_init, "Initialize a repo for tracking" .
 			  " (requires URL argument)",
@@ -2463,6 +2465,13 @@ sub make_log_entry {
 	close $un or croak $!;
 
 	$log_entry{date} = parse_svn_date($log_entry{date});
+	if (defined $_cut_changelog_bits) {
+	    $log_entry{log} =~ s/(^|\n)\s*((\n|\s)*(199[0-9]|
20[0-1][0-9])(-[0-9]{2}){2}\s+.*<.*>\s*\n\s+)?/$1/g;
+	    $log_entry{log} =~ s/(^|\n)\* /\n$1/g;
+	    $log_entry{log} =~ s/^[\n\s]*//;
+	    $log_entry{log} =~ s/\n\s*/ /g if length ($log_entry{log}) < 81;
+	    $log_entry{log} .= "\n";
+	}
 	$log_entry{log} .= "\n";
 	my $author = $log_entry{author} = check_author($log_entry{author});
 	my ($name, $email) = defined $::users{$author} ? @{$::users{$author}}
-- 
1.6.0.rc0.44.g67270


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] git-svn.perl: Strip ChangeLog bits., Jan Nieuwenhuizen, (Sat Aug 2, 9:42 am)
Re: [PATCH] git-svn.perl: Strip ChangeLog bits., Petr Baudis, (Sat Aug 2, 1:27 pm)
Re: [PATCH] git-svn.perl: Strip ChangeLog bits., Jan Nieuwenhuizen, (Sat Aug 2, 2:21 pm)
Re: [PATCH] git-svn.perl: Strip ChangeLog bits., Junio C Hamano, (Sat Aug 2, 1:36 pm)
Re: [PATCH] git-svn.perl: Strip ChangeLog bits., Jan Nieuwenhuizen, (Sat Aug 2, 2:17 pm)
Re: [PATCH] git-svn.perl: Strip ChangeLog bits., Eric Wong, (Sun Aug 3, 10:09 pm)
Re: [PATCH] git-svn.perl: Strip ChangeLog bits., Jan Nieuwenhuizen, (Mon Aug 4, 3:49 am)
Re: [PATCH] git-svn.perl: Strip ChangeLog bits., Eric Wong, (Mon Aug 4, 5:03 am)
Re: [PATCH] git-svn.perl: Strip ChangeLog bits., Jan Nieuwenhuizen, (Mon Aug 4, 7:30 am)
Re: [PATCH] git-svn.perl: Strip ChangeLog bits., Junio C Hamano, (Sun Aug 3, 10:45 pm)