head	1.2;
access;
symbols
	perseant-exfatfs-base-20250801:1.2
	perseant-exfatfs-base-20240630:1.2
	perseant-exfatfs:1.2.0.16
	perseant-exfatfs-base:1.2
	cjep_sun2x:1.2.0.14
	cjep_sun2x-base:1.2
	cjep_staticlib_x-base1:1.2
	cjep_staticlib_x:1.2.0.12
	cjep_staticlib_x-base:1.2
	phil-wifi-20200421:1.2
	phil-wifi-20200411:1.2
	phil-wifi-20200406:1.2
	pgoyette-compat-merge-20190127:1.2
	pgoyette-compat-20190127:1.2
	pgoyette-compat-20190118:1.2
	pgoyette-compat-1226:1.2
	flex-2-6-4:1.1.1.1
	pgoyette-compat-1126:1.2
	pgoyette-compat-1020:1.2
	pgoyette-compat-0930:1.2
	pgoyette-compat-0906:1.2
	netbsd-7-2-RELEASE:1.1.1.1.12.1
	pgoyette-compat-0728:1.2
	pgoyette-compat-0625:1.2
	pgoyette-compat-0521:1.2
	pgoyette-compat-0502:1.2
	pgoyette-compat-0422:1.2
	pgoyette-compat-0415:1.2
	pgoyette-compat-0407:1.2
	pgoyette-compat-0330:1.2
	pgoyette-compat-0322:1.2
	pgoyette-compat-0315:1.2
	netbsd-7-1-2-RELEASE:1.1.1.1.12.1
	pgoyette-compat:1.2.0.10
	pgoyette-compat-base:1.2
	netbsd-7-1-1-RELEASE:1.1.1.1.12.1
	perseant-stdc-iso10646:1.2.0.8
	perseant-stdc-iso10646-base:1.2
	prg-localcount2-base3:1.2
	prg-localcount2-base2:1.2
	prg-localcount2-base1:1.2
	prg-localcount2:1.2.0.6
	prg-localcount2-base:1.2
	pgoyette-localcount-20170426:1.2
	bouyer-socketcan-base1:1.2
	pgoyette-localcount-20170320:1.2
	netbsd-7-1:1.1.1.1.12.1.0.4
	netbsd-7-1-RELEASE:1.1.1.1.12.1
	netbsd-7-1-RC2:1.1.1.1.12.1
	bouyer-socketcan:1.2.0.4
	bouyer-socketcan-base:1.2
	pgoyette-localcount-20170107:1.2
	netbsd-7-1-RC1:1.1.1.1.12.1
	flex-2-6-3:1.1.1.1
	pgoyette-localcount-20161104:1.2
	netbsd-7-0-2-RELEASE:1.1.1.1.12.1
	localcount-20160914:1.2
	pgoyette-localcount-20160806:1.2
	pgoyette-localcount-20160726:1.2
	pgoyette-localcount:1.2.0.2
	pgoyette-localcount-base:1.2
	netbsd-7-0-1-RELEASE:1.1.1.1.12.1
	flex-2-6-0:1.1.1.1
	netbsd-7-0:1.1.1.1.12.1.0.2
	netbsd-7-0-RELEASE:1.1.1.1.12.1
	netbsd-7-0-RC3:1.1.1.1.12.1
	netbsd-7-0-RC2:1.1.1.1.12.1
	netbsd-7-0-RC1:1.1.1.1.12.1
	netbsd-7:1.1.1.1.0.12
	netbsd-7-base:1.1.1.1
	yamt-pagecache:1.1.1.1.0.10
	yamt-pagecache-base9:1.1.1.1
	tls-earlyentropy:1.1.1.1.0.8
	tls-earlyentropy-base:1.1.1.1
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.1
	riastradh-drm2-base3:1.1.1.1
	riastradh-drm2-base2:1.1.1.1
	riastradh-drm2-base1:1.1.1.1
	riastradh-drm2:1.1.1.1.0.6
	riastradh-drm2-base:1.1.1.1
	tls-maxphys-base:1.1.1.1
	tls-maxphys:1.1.1.1.0.4
	khorben-n900:1.1.1.1.0.2
	flex-2-5-37:1.1.1.1
	FLEX:1.1.1;
locks; strict;
comment	@# @;


1.2
date	2014.10.29.18.28.36;	author christos;	state dead;
branches;
next	1.1;
commitid	1RAnCgfHVlUoS7Wx;

1.1
date	2013.04.06.14.06.02;	author christos;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2013.04.06.14.06.02;	author christos;	state Exp;
branches
	1.1.1.1.4.1
	1.1.1.1.10.1
	1.1.1.1.12.1;
next	;

1.1.1.1.4.1
date	2013.04.06.14.06.02;	author tls;	state dead;
branches;
next	1.1.1.1.4.2;
commitid	OnlO1cBgtQRcIHUw;

1.1.1.1.4.2
date	2013.06.23.06.26.38;	author tls;	state Exp;
branches;
next	;
commitid	OnlO1cBgtQRcIHUw;

1.1.1.1.10.1
date	2013.04.06.14.06.02;	author yamt;	state dead;
branches;
next	1.1.1.1.10.2;
commitid	TZ3vYM8ITdVj7yBx;

1.1.1.1.10.2
date	2014.05.22.15.45.10;	author yamt;	state Exp;
branches;
next	;
commitid	TZ3vYM8ITdVj7yBx;

1.1.1.1.12.1
date	2015.03.06.20.49.17;	author snj;	state dead;
branches;
next	;
commitid	nTOobT6jbiujvAcy;


desc
@@


1.2
log
@merge conflicts
@
text
@#!/usr/bin/perl

# Copyright (C) 2007, 2008 Simon Josefsson <simon@@josefsson.org>
# Copyright (C) 2007 Luis Mondesi <lemsx1@@gmail.com>
# * calls git directly. To use it just: 
#   cd ~/Project/my_git_repo; git2cl > ChangeLog
# * implements strptime()
# * fixes bugs in $comment parsing
#   - copy input before we remove leading spaces
#   - skip "merge branch" statements as they don't
#     have information about files (i.e. we never
#     go into $state 2)
#   - behaves like a pipe/filter if input is given from the CLI
#     else it calls git log by itself
#
# The functions mywrap, last_line_len, wrap_log_entry are derived from
# the cvs2cl tool, see <http://www.red-bean.com/cvs2cl/>:
# Copyright (C) 2001,2002,2003,2004 Martyn J. Pearce <fluffy@@cpan.org>
# Copyright (C) 1999 Karl Fogel <kfogel@@red-bean.com>
#
# git2cl is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# git2cl is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with git2cl; see the file COPYING.  If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

use strict;
use POSIX qw(strftime);
use Text::Wrap qw(wrap);
use FileHandle;

use constant EMPTY_LOG_MESSAGE => '*** empty log message ***';

# this is a helper hash for stptime.
# Assumes you are calling 'git log ...' with LC_ALL=C
my %month = (
    'Jan'=>0,
    'Feb'=>1,
    'Mar'=>2,
    'Apr'=>3,
    'May'=>4,
    'Jun'=>5,
    'Jul'=>6,
    'Aug'=>7,
    'Sep'=>8,
    'Oct'=>9,
    'Nov'=>10,
    'Dec'=>11,
);

my $fh = new FileHandle;

sub key_ready
{
    my ($rin, $nfd);
    vec($rin, fileno(STDIN), 1) = 1;
    return $nfd = select($rin, undef, undef, 0);
}

sub strptime {
    my $str = shift;
    return undef if not defined $str;

    # we are parsing this format
    # Fri Oct 26 00:42:56 2007 -0400
    # to these fields
    # sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1
    # Luis Mondesi <lemsx1@@gmail.com>
    my @@date;
    if ($str =~ /([[:alpha:]]{3})\s+([[:alpha:]]{3})\s+([[:digit:]]{1,2})\s+([[:digit:]]{1,2}):([[:digit:]]{1,2}):([[:digit:]]{1,2})\s+([[:digit:]]{4})/){
        push(@@date,$6,$5,$4,$3,$month{$2},($7 - 1900),-1,-1,-1);
    } else {
        die ("Cannot parse date '$str'\n'");
    }
    return @@date;
}

sub mywrap {
    my ($indent1, $indent2, @@text) = @@_;
    # If incoming text looks preformatted, don't get clever
    my $text = Text::Wrap::wrap($indent1, $indent2, @@text);
    if ( grep /^\s+/m, @@text ) {
	return $text;
    }
    my @@lines = split /\n/, $text;
    $indent2 =~ s!^((?: {8})+)!"\t" x (length($1)/8)!e;
    $lines[0] =~ s/^$indent1\s+/$indent1/;
    s/^$indent2\s+/$indent2/
	for @@lines[1..$#lines];
    my $newtext = join "\n", @@lines;
    $newtext .= "\n"
	if substr($text, -1) eq "\n";
    return $newtext;
}

sub last_line_len {
    my $files_list = shift;
    my @@lines = split (/\n/, $files_list);
    my $last_line = pop (@@lines);
    return length ($last_line);
}

# A custom wrap function, sensitive to some common constructs used in
# log entries.
sub wrap_log_entry {
    my $text = shift;                  # The text to wrap.
    my $left_pad_str = shift;          # String to pad with on the left.

    # These do NOT take left_pad_str into account:
    my $length_remaining = shift;      # Amount left on current line.
    my $max_line_length  = shift;      # Amount left for a blank line.

    my $wrapped_text = '';             # The accumulating wrapped entry.
    my $user_indent = '';              # Inherited user_indent from prev line.

    my $first_time = 1;                # First iteration of the loop?
    my $suppress_line_start_match = 0; # Set to disable line start checks.

    my @@lines = split (/\n/, $text);
    while (@@lines)   # Don't use `foreach' here, it won't work.
    {
	my $this_line = shift (@@lines);
	chomp $this_line;

	if ($this_line =~ /^(\s+)/) {
	    $user_indent = $1;
	}
	else {
	    $user_indent = '';
	}

	# If it matches any of the line-start regexps, print a newline now...
	if ($suppress_line_start_match)
	{
	    $suppress_line_start_match = 0;
	}
	elsif (($this_line =~ /^(\s*)\*\s+[a-zA-Z0-9]/)
	       || ($this_line =~ /^(\s*)\* [a-zA-Z0-9_\.\/\+-]+/)
	       || ($this_line =~ /^(\s*)\([a-zA-Z0-9_\.\/\+-]+(\)|,\s*)/)
	       || ($this_line =~ /^(\s+)(\S+)/)
	       || ($this_line =~ /^(\s*)- +/)
	       || ($this_line =~ /^()\s*$/)
	       || ($this_line =~ /^(\s*)\*\) +/)
	       || ($this_line =~ /^(\s*)[a-zA-Z0-9](\)|\.|\:) +/))
	{
	    $length_remaining = $max_line_length - (length ($user_indent));
	}

	# Now that any user_indent has been preserved, strip off leading
	# whitespace, so up-folding has no ugly side-effects.
	$this_line =~ s/^\s*//;

	# Accumulate the line, and adjust parameters for next line.
	my $this_len = length ($this_line);
	if ($this_len == 0)
	{
	    # Blank lines should cancel any user_indent level.
	    $user_indent = '';
	    $length_remaining = $max_line_length;
	}
	elsif ($this_len >= $length_remaining) # Line too long, try breaking it.
	{
	    # Walk backwards from the end.  At first acceptable spot, break
	    # a new line.
	    my $idx = $length_remaining - 1;
	    if ($idx < 0) { $idx = 0 };
	    while ($idx > 0)
	    {
		if (substr ($this_line, $idx, 1) =~ /\s/)
		{
		    my $line_now = substr ($this_line, 0, $idx);
		    my $next_line = substr ($this_line, $idx);
		    $this_line = $line_now;

		    # Clean whitespace off the end.
		    chomp $this_line;

		    # The current line is ready to be printed.
		    $this_line .= "\n${left_pad_str}";

		    # Make sure the next line is allowed full room.
		    $length_remaining = $max_line_length - (length ($user_indent));

		    # Strip next_line, but then preserve any user_indent.
		    $next_line =~ s/^\s*//;

		    # Sneak a peek at the user_indent of the upcoming line, so
		    # $next_line (which will now precede it) can inherit that
		    # indent level.  Otherwise, use whatever user_indent level
		    # we currently have, which might be none.
		    my $next_next_line = shift (@@lines);
		    if ((defined ($next_next_line)) && ($next_next_line =~ /^(\s+)/)) {
			$next_line = $1 . $next_line if (defined ($1));
			# $length_remaining = $max_line_length - (length ($1));
			$next_next_line =~ s/^\s*//;
		    }
		    else {
			$next_line = $user_indent . $next_line;
		    }
		    if (defined ($next_next_line)) {
			unshift (@@lines, $next_next_line);
		    }
		    unshift (@@lines, $next_line);

		    # Our new next line might, coincidentally, begin with one of
		    # the line-start regexps, so we temporarily turn off
		    # sensitivity to that until we're past the line.
		    $suppress_line_start_match = 1;

		    last;
		}
		else
		{
		    $idx--;
		}
	    }

	    if ($idx == 0)
	    {
		# We bottomed out because the line is longer than the
		# available space.  But that could be because the space is
		# small, or because the line is longer than even the maximum
		# possible space.  Handle both cases below.

		if ($length_remaining == ($max_line_length - (length ($user_indent))))
		{
		    # The line is simply too long -- there is no hope of ever
		    # breaking it nicely, so just insert it verbatim, with
		    # appropriate padding.
		    $this_line = "\n${left_pad_str}${this_line}";
		}
		else
		{
		    # Can't break it here, but may be able to on the next round...
		    unshift (@@lines, $this_line);
		    $length_remaining = $max_line_length - (length ($user_indent));
		    $this_line = "\n${left_pad_str}";
		}
	    }
	}
	else  # $this_len < $length_remaining, so tack on what we can.
	{
	    # Leave a note for the next iteration.
	    $length_remaining = $length_remaining - $this_len;

	    if ($this_line =~ /\.$/)
	    {
		$this_line .= "  ";
		$length_remaining -= 2;
	    }
	    else  # not a sentence end
	    {
		$this_line .= " ";
		$length_remaining -= 1;
	    }
	}

	# Unconditionally indicate that loop has run at least once.
	$first_time = 0;

	$wrapped_text .= "${user_indent}${this_line}";
    }

    # One last bit of padding.
    $wrapped_text .= "\n";

    return $wrapped_text;
}

# main

my @@date;
my $author;
my @@files;
my $comment;

my $state; # 0-header 1-comment 2-files
my $done = 0;

$state = 0;

# if reading from STDIN, we assume that we are
# getting git log as input
if (key_ready())
{

    #my $dummyfh; # don't care about writing
    #($fh,$dummyfh) = FileHandle::pipe;
    $fh->fdopen(*STDIN, 'r');
}
else
{
    $fh->open("LC_ALL=C git log --pretty --numstat --summary|")
	or die("Cannot execute git log...$!\n");
}

while (my $_l = <$fh>) {
    #print STDERR "debug ($state, " . (@@date ? (strftime "%Y-%m-%d", @@date) : "") . "): `$_'\n";
    if ($state == 0) {
	if ($_l =~ m,^Author: (.*),) {
	    $author = $1;
	}
	if ($_l =~ m,^Date: (.*),) {
	    @@date = strptime($1);
	}
	$state = 1 if ($_l =~ m,^$, and $author and (@@date+0>0));
    } elsif ($state == 1) {
        # * modifying our input text is a bad choice
        #   let's make a copy of it first, then we remove spaces 
        # * if we meet a "merge branch" statement, we need to start
        #   over and find a real entry
        # Luis Mondesi <lemsx1@@gmail.com>
        my $_s = $_l;
	$_s =~ s/^    //g;
        if ($_s =~ m/^Merge branch/)
        {
            $state=0;
            next;
        }
	$comment = $comment . $_s;
	$state = 2 if ($_l =~ m,^$,);
    } elsif ($state == 2) {
	if ($_l =~ m,^([0-9]+)\t([0-9]+)\t(.*)$,) {
	    push @@files, $3;
	}
	$done = 1 if ($_l =~ m,^$,);
    }

    if ($done) {
	print (strftime "%Y-%m-%d  $author\n\n", @@date);

	my $files = join (", ", @@files);
	$files = mywrap ("\t", "\t", "* $files"), ": ";

	if (index($comment, EMPTY_LOG_MESSAGE) > -1 ) {
	    $comment = "[no log message]\n";
	}

	my $files_last_line_len = 0;
	$files_last_line_len = last_line_len($files) + 1;
	my $msg = wrap_log_entry($comment, "\t", 69-$files_last_line_len, 69);

	$msg =~ s/[ \t]+\n/\n/g;

	print "$files: $msg\n";

	@@date = ();
	$author = "";
	@@files = ();
	$comment = "";

	$state = 0;
	$done = 0;
    }
}

if (@@date + 0)
{
    print (strftime "%Y-%m-%d  $author\n\n", @@date);
    my $msg = wrap_log_entry($comment, "\t", 69, 69);
    $msg =~ s/[ \t]+\n/\n/g;
    print "\t* $msg\n";
}
@


1.1
log
@Initial revision
@
text
@@


1.1.1.1
log
@Import flex 2.5.7
@
text
@@


1.1.1.1.12.1
log
@Pull up following revision(s) (requested by mrg in ticket #571):
	doc/3RDPARTY: 1.1168
	external/bsd/flex/dist/po/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/po/Makefile.in: up to 1.1.1.1
	external/bsd/flex/dist/po/POTFILES: up to 1.1.1.1
	external/bsd/flex/dist/po/en@@boldquot.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/en@@boldquot.po: up to 1.1.1.1
	external/bsd/flex/dist/po/en@@quot.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/en@@quot.po: up to 1.1.1.1
	external/bsd/flex/dist/po/eo.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/eo.po: up to 1.1.1.1
	external/bsd/flex/dist/po/hr.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/hr.po: up to 1.1.1.1
	external/bsd/flex/dist/po/sr.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/sr.po: up to 1.1.1.1
	external/bsd/flex/dist/po/zh_TW.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/zh_TW.po: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-include-by-buffer/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/TEMPLATE/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-alloc-extra/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-array-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-array-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-basic-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-basic-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-bison-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-bison-yylloc/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-bison-yylval/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-c++-basic/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-c++-multiple-scanners/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-c++-yywrap/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-c-cpp-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-c-cpp-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-ccl/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-concatenated-options/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-debug-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-top/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-debug-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-yyextra/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-extended/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-header-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-header-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-include-by-push/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-include-by-reentrant/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-mem-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-mem-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-multiple-scanners-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-multiple-scanners-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-noansi-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-noansi-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-posix/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-posixly-correct/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-prefix-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-prefix-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-pthread/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-quotes/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-reject/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-rescan-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-rescan-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-string-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-string-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-table-opts/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-linedir-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-trailing/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-trailing/Makefile.am: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-trailing/Makefile.in: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-trailing/scanner.l: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-trailing/test.input: up to 1.1.1.1
	external/bsd/flex/dist/m4/intlmacosx.m4: up to 1.1.1.1
	external/bsd/flex/dist/m4/libtool.m4: up to 1.1.1.1
	external/bsd/flex/dist/m4/ltoptions.m4: up to 1.1.1.1
	external/bsd/flex/dist/m4/ltsugar.m4: up to 1.1.1.1
	external/bsd/flex/dist/m4/ltversion.m4: up to 1.1.1.1
	external/bsd/flex/dist/m4/lt~obsolete.m4: up to 1.1.1.1
	external/bsd/flex/dist/doc/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/examples/fastwc/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/examples/manual/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/examples/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/libtool: up to 1.1.1.1
	external/bsd/flex/dist/stamp-h1: up to 1.1.1.1
	external/bsd/flex/dist/ltmain.sh: up to 1.1.1.1
	external/bsd/flex/dist/lib/.deps/lib.Plo: up to 1.1.1.1
	external/bsd/flex/dist/lib/.deps/malloc.Po: up to 1.1.1.1
	external/bsd/flex/dist/lib/.deps/realloc.Po: up to 1.1.1.1
	external/bsd/flex/dist/lib/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/configure.ac: up to 1.1.1.1
	external/bsd/flex/dist/.indent.pro: up to 1.1.1.1
	external/bsd/flex/dist/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/README-alpha: delete
	external/bsd/flex/dist/README.cvs: delete
	external/bsd/flex/dist/configure.in: delete
	external/bsd/flex/dist/mkinstalldirs: delete
	external/bsd/flex/dist/tools/Makefile.am: delete
	external/bsd/flex/dist/tools/Makefile.in: delete
	external/bsd/flex/dist/tools/git2cl: delete
	external/bsd/flex/flex2netbsd: up to 1.3
	external/bsd/flex/dist/.indent.pro: up to 1.1.1.1
	external/bsd/flex/dist/ABOUT-NLS: up to 1.1.1.2
	external/bsd/flex/dist/ChangeLog: up to 1.1.1.3
	external/bsd/flex/dist/INSTALL: up to 1.1.1.3
	external/bsd/flex/dist/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/Makefile.am: up to 1.1.1.3
	external/bsd/flex/dist/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/NEWS: up to 1.1.1.3
	external/bsd/flex/dist/README: up to 1.1.1.2
	external/bsd/flex/dist/TODO: up to 1.1.1.2
	external/bsd/flex/dist/aclocal.m4: up to 1.1.1.3
	external/bsd/flex/dist/autogen.sh: up to 1.1.1.2
	external/bsd/flex/dist/buf.c: up to 1.4
	external/bsd/flex/dist/ccl.c: up to 1.3
	external/bsd/flex/dist/compile: up to 1.1.1.3
	external/bsd/flex/dist/conf.in: up to 1.1.1.3
	external/bsd/flex/dist/config.guess: up to 1.1.1.3
	external/bsd/flex/dist/config.rpath: up to 1.1.1.2
	external/bsd/flex/dist/config.sub: up to 1.1.1.3
	external/bsd/flex/dist/configure: up to 1.1.1.3
	external/bsd/flex/dist/configure.ac: up to 1.1.1.1
	external/bsd/flex/dist/depcomp: up to 1.1.1.3
	external/bsd/flex/dist/dfa.c: up to 1.3
	external/bsd/flex/dist/ecs.c: up to 1.3
	external/bsd/flex/dist/filter.c: up to 1.5
	external/bsd/flex/dist/flex.skl: up to 1.11
	external/bsd/flex/dist/flexdef.h: up to 1.7
	external/bsd/flex/dist/gen.c: up to 1.11
	external/bsd/flex/dist/initparse.c: up to 1.5
	external/bsd/flex/dist/install-sh: up to 1.1.1.3
	external/bsd/flex/dist/libmain.c: up to 1.5
	external/bsd/flex/dist/libtool: up to 1.1.1.1
	external/bsd/flex/dist/libyywrap.c: up to 1.5
	external/bsd/flex/dist/ltmain.sh: up to 1.1.1.1
	external/bsd/flex/dist/main.c: up to 1.6
	external/bsd/flex/dist/misc.c: up to 1.5
	external/bsd/flex/dist/missing: up to 1.1.1.3
	external/bsd/flex/dist/nfa.c: up to 1.3
	external/bsd/flex/dist/options.c: up to 1.3
	external/bsd/flex/dist/parse.y: up to 1.5
	external/bsd/flex/dist/regex.c: up to 1.3
	external/bsd/flex/dist/scan.l: up to 1.6
	external/bsd/flex/dist/scanflags.c: up to 1.3
	external/bsd/flex/dist/scanopt.c: up to 1.6
	external/bsd/flex/dist/stamp-h1: up to 1.1.1.1
	external/bsd/flex/dist/sym.c: up to 1.3
	external/bsd/flex/dist/tables.c: up to 1.5
	external/bsd/flex/dist/tables_shared.c: up to 1.1.1.2
	external/bsd/flex/dist/tables_shared.h: up to 1.1.1.2
	external/bsd/flex/dist/tblcmp.c: up to 1.3
	external/bsd/flex/dist/version.h: up to 1.1.1.2
	external/bsd/flex/dist/ylwrap: up to 1.1.1.2
	external/bsd/flex/dist/yylex.c: up to 1.4
	external/bsd/flex/dist/doc/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/doc/Makefile.am: up to 1.1.1.3
	external/bsd/flex/dist/doc/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/doc/flex.1: up to 1.1.1.3
	external/bsd/flex/dist/doc/flex.info: up to 1.1.1.3
	external/bsd/flex/dist/doc/flex.info-1: up to 1.1.1.3
	external/bsd/flex/dist/doc/flex.pdf: up to 1.1.1.3
	external/bsd/flex/dist/doc/flex.texi: up to 1.1.1.3
	external/bsd/flex/dist/doc/mdate-sh: up to 1.1.1.3
	external/bsd/flex/dist/doc/stamp-vti: up to 1.1.1.3
	external/bsd/flex/dist/doc/texinfo.tex: up to 1.1.1.3
	external/bsd/flex/dist/doc/version.texi: up to 1.1.1.3
	external/bsd/flex/dist/examples/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/examples/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/examples/testxxLexer.l: up to 1.1.1.2
	external/bsd/flex/dist/examples/fastwc/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/examples/fastwc/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/examples/fastwc/mywc.c: up to 1.1.1.2
	external/bsd/flex/dist/examples/fastwc/wc1.l: up to 1.1.1.2
	external/bsd/flex/dist/examples/fastwc/wc2.l: up to 1.1.1.2
	external/bsd/flex/dist/examples/fastwc/wc3.l: up to 1.1.1.2
	external/bsd/flex/dist/examples/fastwc/wc4.l: up to 1.1.1.2
	external/bsd/flex/dist/examples/fastwc/wc5.l: up to 1.1.1.2
	external/bsd/flex/dist/examples/manual/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/examples/manual/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/examples/manual/expr.y: up to 1.1.1.2
	external/bsd/flex/dist/examples/manual/front.y: up to 1.1.1.2
	external/bsd/flex/dist/lib/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/lib/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/lib/Makefile.in: up to 1.1.1.2
	external/bsd/flex/dist/lib/lib.c: up to 1.1.1.2
	external/bsd/flex/dist/lib/malloc.c: up to 1.1.1.2
	external/bsd/flex/dist/lib/realloc.c: up to 1.1.1.2
	external/bsd/flex/dist/lib/.deps/lib.Plo: up to 1.1.1.1
	external/bsd/flex/dist/lib/.deps/malloc.Po: up to 1.1.1.1
	external/bsd/flex/dist/lib/.deps/realloc.Po: up to 1.1.1.1
	external/bsd/flex/dist/m4/gettext.m4: up to 1.1.1.2
	external/bsd/flex/dist/m4/iconv.m4: up to 1.1.1.2
	external/bsd/flex/dist/m4/intlmacosx.m4: up to 1.1.1.1
	external/bsd/flex/dist/m4/lib-ld.m4: up to 1.1.1.2
	external/bsd/flex/dist/m4/lib-link.m4: up to 1.1.1.2
	external/bsd/flex/dist/m4/lib-prefix.m4: up to 1.1.1.2
	external/bsd/flex/dist/m4/libtool.m4: up to 1.1.1.1
	external/bsd/flex/dist/m4/ltoptions.m4: up to 1.1.1.1
	external/bsd/flex/dist/m4/ltsugar.m4: up to 1.1.1.1
	external/bsd/flex/dist/m4/ltversion.m4: up to 1.1.1.1
	external/bsd/flex/dist/m4/lt~obsolete.m4: up to 1.1.1.1
	external/bsd/flex/dist/m4/nls.m4: up to 1.1.1.2
	external/bsd/flex/dist/m4/po.m4: up to 1.1.1.2
	external/bsd/flex/dist/m4/progtest.m4: up to 1.1.1.2
	external/bsd/flex/dist/po/LINGUAS: up to 1.1.1.3
	external/bsd/flex/dist/po/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/po/Makefile.in: up to 1.1.1.1
	external/bsd/flex/dist/po/Makefile.in.in: up to 1.1.1.2
	external/bsd/flex/dist/po/POTFILES: up to 1.1.1.1
	external/bsd/flex/dist/po/Rules-quot: up to 1.1.1.2
	external/bsd/flex/dist/po/ca.po: up to 1.1.1.3
	external/bsd/flex/dist/po/da.po: up to 1.1.1.3
	external/bsd/flex/dist/po/de.po: up to 1.1.1.3
	external/bsd/flex/dist/po/en@@boldquot.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/en@@boldquot.po: up to 1.1.1.1
	external/bsd/flex/dist/po/en@@quot.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/en@@quot.po: up to 1.1.1.1
	external/bsd/flex/dist/po/eo.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/eo.po: up to 1.1.1.1
	external/bsd/flex/dist/po/es.po: up to 1.1.1.3
	external/bsd/flex/dist/po/fi.gmo: up to 1.1.1.2
	external/bsd/flex/dist/po/fi.po: up to 1.1.1.2
	external/bsd/flex/dist/po/flex.pot: up to 1.1.1.3
	external/bsd/flex/dist/po/fr.po: up to 1.1.1.3
	external/bsd/flex/dist/po/ga.po: up to 1.1.1.3
	external/bsd/flex/dist/po/hr.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/hr.po: up to 1.1.1.1
	external/bsd/flex/dist/po/ko.po: up to 1.1.1.3
	external/bsd/flex/dist/po/nl.po: up to 1.1.1.3
	external/bsd/flex/dist/po/pl.po: up to 1.1.1.3
	external/bsd/flex/dist/po/pt_BR.po: up to 1.1.1.3
	external/bsd/flex/dist/po/ro.po: up to 1.1.1.3
	external/bsd/flex/dist/po/ru.po: up to 1.1.1.3
	external/bsd/flex/dist/po/sr.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/sr.po: up to 1.1.1.1
	external/bsd/flex/dist/po/sv.po: up to 1.1.1.3
	external/bsd/flex/dist/po/tr.po: up to 1.1.1.3
	external/bsd/flex/dist/po/vi.po: up to 1.1.1.3
	external/bsd/flex/dist/po/zh_CN.po: up to 1.1.1.3
	external/bsd/flex/dist/po/zh_TW.gmo: up to 1.1.1.1
	external/bsd/flex/dist/po/zh_TW.po: up to 1.1.1.1
	external/bsd/flex/dist/tests/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/TEMPLATE/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/TEMPLATE/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/TEMPLATE/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/TEMPLATE/parser.y: up to 1.1.1.2
	external/bsd/flex/dist/tests/TEMPLATE/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-alloc-extra/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-alloc-extra/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-alloc-extra/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-alloc-extra/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-array-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-array-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-array-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-array-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-array-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-array-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-array-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-array-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-basic-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-basic-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-basic-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-basic-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-basic-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-basic-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-basic-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-basic-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-bison-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-bison-nr/Makefile.am: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-bison-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-bison-nr/main.c: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-bison-nr/parser.y: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-bison-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-bison-yylloc/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-bison-yylloc/Makefile.am: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-bison-yylloc/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-bison-yylloc/main.c: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-bison-yylloc/parser.y: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-bison-yylloc/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-bison-yylval/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-bison-yylval/Makefile.am: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-bison-yylval/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-bison-yylval/main.c: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-bison-yylval/parser.y: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-bison-yylval/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-c++-basic/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-c++-basic/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-c++-basic/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-c++-basic/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-c++-multiple-scanners/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-c++-multiple-scanners/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-c++-multiple-scanners/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-c++-multiple-scanners/scanner-1.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-c++-multiple-scanners/scanner-2.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-c++-yywrap/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-c++-yywrap/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-c++-yywrap/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-c++-yywrap/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-c-cpp-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-c-cpp-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-c-cpp-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-c-cpp-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-c-cpp-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-c-cpp-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-c-cpp-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-c-cpp-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-ccl/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-ccl/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-ccl/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-ccl/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-concatenated-options/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-concatenated-options/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-debug-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-debug-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-debug-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-debug-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-debug-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-debug-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-debug-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-debug-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-extended/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-extended/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-extended/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-extended/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-header-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-header-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-header-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-header-nr/main.c: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-header-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-header-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-header-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-header-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-header-r/main.c: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-header-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-include-by-buffer/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-include-by-buffer/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-include-by-buffer/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-include-by-buffer/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-include-by-push/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-include-by-push/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-include-by-push/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-include-by-push/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-include-by-reentrant/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-include-by-reentrant/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-include-by-reentrant/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-include-by-reentrant/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-linedir-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-linedir-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-linedir-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-linedir-r/main.c: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-linedir-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-lineno-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-lineno-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-lineno-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-lineno-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-lineno-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-lineno-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-lineno-trailing/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-trailing/Makefile.am: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-trailing/Makefile.in: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-trailing/scanner.l: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-lineno-trailing/test.input: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-mem-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-mem-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-mem-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-mem-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-mem-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-mem-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-mem-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-mem-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-multiple-scanners-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-multiple-scanners-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-multiple-scanners-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-multiple-scanners-nr/main.c: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-multiple-scanners-nr/scanner-1.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-multiple-scanners-nr/scanner-2.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-multiple-scanners-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-multiple-scanners-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-multiple-scanners-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-multiple-scanners-r/main.c: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-multiple-scanners-r/scanner-1.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-multiple-scanners-r/scanner-2.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-noansi-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-noansi-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-noansi-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-noansi-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-noansi-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-noansi-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-noansi-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-noansi-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-posix/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-posix/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-posix/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-posix/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-posixly-correct/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-posixly-correct/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-posixly-correct/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-posixly-correct/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-prefix-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-prefix-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-prefix-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-prefix-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-prefix-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-prefix-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-prefix-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-prefix-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-pthread/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-pthread/Makefile.am: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-pthread/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-pthread/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-quotes/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-quotes/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-quotes/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-quotes/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-reject/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-reject/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-reject/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-reject/scanner.l: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-rescan-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-rescan-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-rescan-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-rescan-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-rescan-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-rescan-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-rescan-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-rescan-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-string-nr/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-string-nr/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-string-nr/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-string-nr/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-string-r/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-string-r/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-string-r/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-string-r/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-table-opts/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-table-opts/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-table-opts/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-table-opts/scanner.l: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-top/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-top/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-top/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-top/main.c: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-top/scanner.l: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-yyextra/Makefile: up to 1.1.1.1
	external/bsd/flex/dist/tests/test-yyextra/Makefile.am: up to 1.1.1.2
	external/bsd/flex/dist/tests/test-yyextra/Makefile.in: up to 1.1.1.3
	external/bsd/flex/dist/tests/test-yyextra/scanner.l: up to 1.1.1.2
	external/bsd/flex/include/config.h: up to 1.5
Update flex to 2.5.39.
@
text
@@


1.1.1.1.10.1
log
@file git2cl was added on branch yamt-pagecache on 2014-05-22 15:45:10 +0000
@
text
@d1 372
@


1.1.1.1.10.2
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@a0 372
#!/usr/bin/perl

# Copyright (C) 2007, 2008 Simon Josefsson <simon@@josefsson.org>
# Copyright (C) 2007 Luis Mondesi <lemsx1@@gmail.com>
# * calls git directly. To use it just: 
#   cd ~/Project/my_git_repo; git2cl > ChangeLog
# * implements strptime()
# * fixes bugs in $comment parsing
#   - copy input before we remove leading spaces
#   - skip "merge branch" statements as they don't
#     have information about files (i.e. we never
#     go into $state 2)
#   - behaves like a pipe/filter if input is given from the CLI
#     else it calls git log by itself
#
# The functions mywrap, last_line_len, wrap_log_entry are derived from
# the cvs2cl tool, see <http://www.red-bean.com/cvs2cl/>:
# Copyright (C) 2001,2002,2003,2004 Martyn J. Pearce <fluffy@@cpan.org>
# Copyright (C) 1999 Karl Fogel <kfogel@@red-bean.com>
#
# git2cl is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# git2cl is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with git2cl; see the file COPYING.  If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

use strict;
use POSIX qw(strftime);
use Text::Wrap qw(wrap);
use FileHandle;

use constant EMPTY_LOG_MESSAGE => '*** empty log message ***';

# this is a helper hash for stptime.
# Assumes you are calling 'git log ...' with LC_ALL=C
my %month = (
    'Jan'=>0,
    'Feb'=>1,
    'Mar'=>2,
    'Apr'=>3,
    'May'=>4,
    'Jun'=>5,
    'Jul'=>6,
    'Aug'=>7,
    'Sep'=>8,
    'Oct'=>9,
    'Nov'=>10,
    'Dec'=>11,
);

my $fh = new FileHandle;

sub key_ready
{
    my ($rin, $nfd);
    vec($rin, fileno(STDIN), 1) = 1;
    return $nfd = select($rin, undef, undef, 0);
}

sub strptime {
    my $str = shift;
    return undef if not defined $str;

    # we are parsing this format
    # Fri Oct 26 00:42:56 2007 -0400
    # to these fields
    # sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1
    # Luis Mondesi <lemsx1@@gmail.com>
    my @@date;
    if ($str =~ /([[:alpha:]]{3})\s+([[:alpha:]]{3})\s+([[:digit:]]{1,2})\s+([[:digit:]]{1,2}):([[:digit:]]{1,2}):([[:digit:]]{1,2})\s+([[:digit:]]{4})/){
        push(@@date,$6,$5,$4,$3,$month{$2},($7 - 1900),-1,-1,-1);
    } else {
        die ("Cannot parse date '$str'\n'");
    }
    return @@date;
}

sub mywrap {
    my ($indent1, $indent2, @@text) = @@_;
    # If incoming text looks preformatted, don't get clever
    my $text = Text::Wrap::wrap($indent1, $indent2, @@text);
    if ( grep /^\s+/m, @@text ) {
	return $text;
    }
    my @@lines = split /\n/, $text;
    $indent2 =~ s!^((?: {8})+)!"\t" x (length($1)/8)!e;
    $lines[0] =~ s/^$indent1\s+/$indent1/;
    s/^$indent2\s+/$indent2/
	for @@lines[1..$#lines];
    my $newtext = join "\n", @@lines;
    $newtext .= "\n"
	if substr($text, -1) eq "\n";
    return $newtext;
}

sub last_line_len {
    my $files_list = shift;
    my @@lines = split (/\n/, $files_list);
    my $last_line = pop (@@lines);
    return length ($last_line);
}

# A custom wrap function, sensitive to some common constructs used in
# log entries.
sub wrap_log_entry {
    my $text = shift;                  # The text to wrap.
    my $left_pad_str = shift;          # String to pad with on the left.

    # These do NOT take left_pad_str into account:
    my $length_remaining = shift;      # Amount left on current line.
    my $max_line_length  = shift;      # Amount left for a blank line.

    my $wrapped_text = '';             # The accumulating wrapped entry.
    my $user_indent = '';              # Inherited user_indent from prev line.

    my $first_time = 1;                # First iteration of the loop?
    my $suppress_line_start_match = 0; # Set to disable line start checks.

    my @@lines = split (/\n/, $text);
    while (@@lines)   # Don't use `foreach' here, it won't work.
    {
	my $this_line = shift (@@lines);
	chomp $this_line;

	if ($this_line =~ /^(\s+)/) {
	    $user_indent = $1;
	}
	else {
	    $user_indent = '';
	}

	# If it matches any of the line-start regexps, print a newline now...
	if ($suppress_line_start_match)
	{
	    $suppress_line_start_match = 0;
	}
	elsif (($this_line =~ /^(\s*)\*\s+[a-zA-Z0-9]/)
	       || ($this_line =~ /^(\s*)\* [a-zA-Z0-9_\.\/\+-]+/)
	       || ($this_line =~ /^(\s*)\([a-zA-Z0-9_\.\/\+-]+(\)|,\s*)/)
	       || ($this_line =~ /^(\s+)(\S+)/)
	       || ($this_line =~ /^(\s*)- +/)
	       || ($this_line =~ /^()\s*$/)
	       || ($this_line =~ /^(\s*)\*\) +/)
	       || ($this_line =~ /^(\s*)[a-zA-Z0-9](\)|\.|\:) +/))
	{
	    $length_remaining = $max_line_length - (length ($user_indent));
	}

	# Now that any user_indent has been preserved, strip off leading
	# whitespace, so up-folding has no ugly side-effects.
	$this_line =~ s/^\s*//;

	# Accumulate the line, and adjust parameters for next line.
	my $this_len = length ($this_line);
	if ($this_len == 0)
	{
	    # Blank lines should cancel any user_indent level.
	    $user_indent = '';
	    $length_remaining = $max_line_length;
	}
	elsif ($this_len >= $length_remaining) # Line too long, try breaking it.
	{
	    # Walk backwards from the end.  At first acceptable spot, break
	    # a new line.
	    my $idx = $length_remaining - 1;
	    if ($idx < 0) { $idx = 0 };
	    while ($idx > 0)
	    {
		if (substr ($this_line, $idx, 1) =~ /\s/)
		{
		    my $line_now = substr ($this_line, 0, $idx);
		    my $next_line = substr ($this_line, $idx);
		    $this_line = $line_now;

		    # Clean whitespace off the end.
		    chomp $this_line;

		    # The current line is ready to be printed.
		    $this_line .= "\n${left_pad_str}";

		    # Make sure the next line is allowed full room.
		    $length_remaining = $max_line_length - (length ($user_indent));

		    # Strip next_line, but then preserve any user_indent.
		    $next_line =~ s/^\s*//;

		    # Sneak a peek at the user_indent of the upcoming line, so
		    # $next_line (which will now precede it) can inherit that
		    # indent level.  Otherwise, use whatever user_indent level
		    # we currently have, which might be none.
		    my $next_next_line = shift (@@lines);
		    if ((defined ($next_next_line)) && ($next_next_line =~ /^(\s+)/)) {
			$next_line = $1 . $next_line if (defined ($1));
			# $length_remaining = $max_line_length - (length ($1));
			$next_next_line =~ s/^\s*//;
		    }
		    else {
			$next_line = $user_indent . $next_line;
		    }
		    if (defined ($next_next_line)) {
			unshift (@@lines, $next_next_line);
		    }
		    unshift (@@lines, $next_line);

		    # Our new next line might, coincidentally, begin with one of
		    # the line-start regexps, so we temporarily turn off
		    # sensitivity to that until we're past the line.
		    $suppress_line_start_match = 1;

		    last;
		}
		else
		{
		    $idx--;
		}
	    }

	    if ($idx == 0)
	    {
		# We bottomed out because the line is longer than the
		# available space.  But that could be because the space is
		# small, or because the line is longer than even the maximum
		# possible space.  Handle both cases below.

		if ($length_remaining == ($max_line_length - (length ($user_indent))))
		{
		    # The line is simply too long -- there is no hope of ever
		    # breaking it nicely, so just insert it verbatim, with
		    # appropriate padding.
		    $this_line = "\n${left_pad_str}${this_line}";
		}
		else
		{
		    # Can't break it here, but may be able to on the next round...
		    unshift (@@lines, $this_line);
		    $length_remaining = $max_line_length - (length ($user_indent));
		    $this_line = "\n${left_pad_str}";
		}
	    }
	}
	else  # $this_len < $length_remaining, so tack on what we can.
	{
	    # Leave a note for the next iteration.
	    $length_remaining = $length_remaining - $this_len;

	    if ($this_line =~ /\.$/)
	    {
		$this_line .= "  ";
		$length_remaining -= 2;
	    }
	    else  # not a sentence end
	    {
		$this_line .= " ";
		$length_remaining -= 1;
	    }
	}

	# Unconditionally indicate that loop has run at least once.
	$first_time = 0;

	$wrapped_text .= "${user_indent}${this_line}";
    }

    # One last bit of padding.
    $wrapped_text .= "\n";

    return $wrapped_text;
}

# main

my @@date;
my $author;
my @@files;
my $comment;

my $state; # 0-header 1-comment 2-files
my $done = 0;

$state = 0;

# if reading from STDIN, we assume that we are
# getting git log as input
if (key_ready())
{

    #my $dummyfh; # don't care about writing
    #($fh,$dummyfh) = FileHandle::pipe;
    $fh->fdopen(*STDIN, 'r');
}
else
{
    $fh->open("LC_ALL=C git log --pretty --numstat --summary|")
	or die("Cannot execute git log...$!\n");
}

while (my $_l = <$fh>) {
    #print STDERR "debug ($state, " . (@@date ? (strftime "%Y-%m-%d", @@date) : "") . "): `$_'\n";
    if ($state == 0) {
	if ($_l =~ m,^Author: (.*),) {
	    $author = $1;
	}
	if ($_l =~ m,^Date: (.*),) {
	    @@date = strptime($1);
	}
	$state = 1 if ($_l =~ m,^$, and $author and (@@date+0>0));
    } elsif ($state == 1) {
        # * modifying our input text is a bad choice
        #   let's make a copy of it first, then we remove spaces 
        # * if we meet a "merge branch" statement, we need to start
        #   over and find a real entry
        # Luis Mondesi <lemsx1@@gmail.com>
        my $_s = $_l;
	$_s =~ s/^    //g;
        if ($_s =~ m/^Merge branch/)
        {
            $state=0;
            next;
        }
	$comment = $comment . $_s;
	$state = 2 if ($_l =~ m,^$,);
    } elsif ($state == 2) {
	if ($_l =~ m,^([0-9]+)\t([0-9]+)\t(.*)$,) {
	    push @@files, $3;
	}
	$done = 1 if ($_l =~ m,^$,);
    }

    if ($done) {
	print (strftime "%Y-%m-%d  $author\n\n", @@date);

	my $files = join (", ", @@files);
	$files = mywrap ("\t", "\t", "* $files"), ": ";

	if (index($comment, EMPTY_LOG_MESSAGE) > -1 ) {
	    $comment = "[no log message]\n";
	}

	my $files_last_line_len = 0;
	$files_last_line_len = last_line_len($files) + 1;
	my $msg = wrap_log_entry($comment, "\t", 69-$files_last_line_len, 69);

	$msg =~ s/[ \t]+\n/\n/g;

	print "$files: $msg\n";

	@@date = ();
	$author = "";
	@@files = ();
	$comment = "";

	$state = 0;
	$done = 0;
    }
}

if (@@date + 0)
{
    print (strftime "%Y-%m-%d  $author\n\n", @@date);
    my $msg = wrap_log_entry($comment, "\t", 69, 69);
    $msg =~ s/[ \t]+\n/\n/g;
    print "\t* $msg\n";
}
@


1.1.1.1.4.1
log
@file git2cl was added on branch tls-maxphys on 2013-06-23 06:26:38 +0000
@
text
@d1 372
@


1.1.1.1.4.2
log
@resync from head
@
text
@a0 372
#!/usr/bin/perl

# Copyright (C) 2007, 2008 Simon Josefsson <simon@@josefsson.org>
# Copyright (C) 2007 Luis Mondesi <lemsx1@@gmail.com>
# * calls git directly. To use it just: 
#   cd ~/Project/my_git_repo; git2cl > ChangeLog
# * implements strptime()
# * fixes bugs in $comment parsing
#   - copy input before we remove leading spaces
#   - skip "merge branch" statements as they don't
#     have information about files (i.e. we never
#     go into $state 2)
#   - behaves like a pipe/filter if input is given from the CLI
#     else it calls git log by itself
#
# The functions mywrap, last_line_len, wrap_log_entry are derived from
# the cvs2cl tool, see <http://www.red-bean.com/cvs2cl/>:
# Copyright (C) 2001,2002,2003,2004 Martyn J. Pearce <fluffy@@cpan.org>
# Copyright (C) 1999 Karl Fogel <kfogel@@red-bean.com>
#
# git2cl is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# git2cl is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with git2cl; see the file COPYING.  If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

use strict;
use POSIX qw(strftime);
use Text::Wrap qw(wrap);
use FileHandle;

use constant EMPTY_LOG_MESSAGE => '*** empty log message ***';

# this is a helper hash for stptime.
# Assumes you are calling 'git log ...' with LC_ALL=C
my %month = (
    'Jan'=>0,
    'Feb'=>1,
    'Mar'=>2,
    'Apr'=>3,
    'May'=>4,
    'Jun'=>5,
    'Jul'=>6,
    'Aug'=>7,
    'Sep'=>8,
    'Oct'=>9,
    'Nov'=>10,
    'Dec'=>11,
);

my $fh = new FileHandle;

sub key_ready
{
    my ($rin, $nfd);
    vec($rin, fileno(STDIN), 1) = 1;
    return $nfd = select($rin, undef, undef, 0);
}

sub strptime {
    my $str = shift;
    return undef if not defined $str;

    # we are parsing this format
    # Fri Oct 26 00:42:56 2007 -0400
    # to these fields
    # sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1
    # Luis Mondesi <lemsx1@@gmail.com>
    my @@date;
    if ($str =~ /([[:alpha:]]{3})\s+([[:alpha:]]{3})\s+([[:digit:]]{1,2})\s+([[:digit:]]{1,2}):([[:digit:]]{1,2}):([[:digit:]]{1,2})\s+([[:digit:]]{4})/){
        push(@@date,$6,$5,$4,$3,$month{$2},($7 - 1900),-1,-1,-1);
    } else {
        die ("Cannot parse date '$str'\n'");
    }
    return @@date;
}

sub mywrap {
    my ($indent1, $indent2, @@text) = @@_;
    # If incoming text looks preformatted, don't get clever
    my $text = Text::Wrap::wrap($indent1, $indent2, @@text);
    if ( grep /^\s+/m, @@text ) {
	return $text;
    }
    my @@lines = split /\n/, $text;
    $indent2 =~ s!^((?: {8})+)!"\t" x (length($1)/8)!e;
    $lines[0] =~ s/^$indent1\s+/$indent1/;
    s/^$indent2\s+/$indent2/
	for @@lines[1..$#lines];
    my $newtext = join "\n", @@lines;
    $newtext .= "\n"
	if substr($text, -1) eq "\n";
    return $newtext;
}

sub last_line_len {
    my $files_list = shift;
    my @@lines = split (/\n/, $files_list);
    my $last_line = pop (@@lines);
    return length ($last_line);
}

# A custom wrap function, sensitive to some common constructs used in
# log entries.
sub wrap_log_entry {
    my $text = shift;                  # The text to wrap.
    my $left_pad_str = shift;          # String to pad with on the left.

    # These do NOT take left_pad_str into account:
    my $length_remaining = shift;      # Amount left on current line.
    my $max_line_length  = shift;      # Amount left for a blank line.

    my $wrapped_text = '';             # The accumulating wrapped entry.
    my $user_indent = '';              # Inherited user_indent from prev line.

    my $first_time = 1;                # First iteration of the loop?
    my $suppress_line_start_match = 0; # Set to disable line start checks.

    my @@lines = split (/\n/, $text);
    while (@@lines)   # Don't use `foreach' here, it won't work.
    {
	my $this_line = shift (@@lines);
	chomp $this_line;

	if ($this_line =~ /^(\s+)/) {
	    $user_indent = $1;
	}
	else {
	    $user_indent = '';
	}

	# If it matches any of the line-start regexps, print a newline now...
	if ($suppress_line_start_match)
	{
	    $suppress_line_start_match = 0;
	}
	elsif (($this_line =~ /^(\s*)\*\s+[a-zA-Z0-9]/)
	       || ($this_line =~ /^(\s*)\* [a-zA-Z0-9_\.\/\+-]+/)
	       || ($this_line =~ /^(\s*)\([a-zA-Z0-9_\.\/\+-]+(\)|,\s*)/)
	       || ($this_line =~ /^(\s+)(\S+)/)
	       || ($this_line =~ /^(\s*)- +/)
	       || ($this_line =~ /^()\s*$/)
	       || ($this_line =~ /^(\s*)\*\) +/)
	       || ($this_line =~ /^(\s*)[a-zA-Z0-9](\)|\.|\:) +/))
	{
	    $length_remaining = $max_line_length - (length ($user_indent));
	}

	# Now that any user_indent has been preserved, strip off leading
	# whitespace, so up-folding has no ugly side-effects.
	$this_line =~ s/^\s*//;

	# Accumulate the line, and adjust parameters for next line.
	my $this_len = length ($this_line);
	if ($this_len == 0)
	{
	    # Blank lines should cancel any user_indent level.
	    $user_indent = '';
	    $length_remaining = $max_line_length;
	}
	elsif ($this_len >= $length_remaining) # Line too long, try breaking it.
	{
	    # Walk backwards from the end.  At first acceptable spot, break
	    # a new line.
	    my $idx = $length_remaining - 1;
	    if ($idx < 0) { $idx = 0 };
	    while ($idx > 0)
	    {
		if (substr ($this_line, $idx, 1) =~ /\s/)
		{
		    my $line_now = substr ($this_line, 0, $idx);
		    my $next_line = substr ($this_line, $idx);
		    $this_line = $line_now;

		    # Clean whitespace off the end.
		    chomp $this_line;

		    # The current line is ready to be printed.
		    $this_line .= "\n${left_pad_str}";

		    # Make sure the next line is allowed full room.
		    $length_remaining = $max_line_length - (length ($user_indent));

		    # Strip next_line, but then preserve any user_indent.
		    $next_line =~ s/^\s*//;

		    # Sneak a peek at the user_indent of the upcoming line, so
		    # $next_line (which will now precede it) can inherit that
		    # indent level.  Otherwise, use whatever user_indent level
		    # we currently have, which might be none.
		    my $next_next_line = shift (@@lines);
		    if ((defined ($next_next_line)) && ($next_next_line =~ /^(\s+)/)) {
			$next_line = $1 . $next_line if (defined ($1));
			# $length_remaining = $max_line_length - (length ($1));
			$next_next_line =~ s/^\s*//;
		    }
		    else {
			$next_line = $user_indent . $next_line;
		    }
		    if (defined ($next_next_line)) {
			unshift (@@lines, $next_next_line);
		    }
		    unshift (@@lines, $next_line);

		    # Our new next line might, coincidentally, begin with one of
		    # the line-start regexps, so we temporarily turn off
		    # sensitivity to that until we're past the line.
		    $suppress_line_start_match = 1;

		    last;
		}
		else
		{
		    $idx--;
		}
	    }

	    if ($idx == 0)
	    {
		# We bottomed out because the line is longer than the
		# available space.  But that could be because the space is
		# small, or because the line is longer than even the maximum
		# possible space.  Handle both cases below.

		if ($length_remaining == ($max_line_length - (length ($user_indent))))
		{
		    # The line is simply too long -- there is no hope of ever
		    # breaking it nicely, so just insert it verbatim, with
		    # appropriate padding.
		    $this_line = "\n${left_pad_str}${this_line}";
		}
		else
		{
		    # Can't break it here, but may be able to on the next round...
		    unshift (@@lines, $this_line);
		    $length_remaining = $max_line_length - (length ($user_indent));
		    $this_line = "\n${left_pad_str}";
		}
	    }
	}
	else  # $this_len < $length_remaining, so tack on what we can.
	{
	    # Leave a note for the next iteration.
	    $length_remaining = $length_remaining - $this_len;

	    if ($this_line =~ /\.$/)
	    {
		$this_line .= "  ";
		$length_remaining -= 2;
	    }
	    else  # not a sentence end
	    {
		$this_line .= " ";
		$length_remaining -= 1;
	    }
	}

	# Unconditionally indicate that loop has run at least once.
	$first_time = 0;

	$wrapped_text .= "${user_indent}${this_line}";
    }

    # One last bit of padding.
    $wrapped_text .= "\n";

    return $wrapped_text;
}

# main

my @@date;
my $author;
my @@files;
my $comment;

my $state; # 0-header 1-comment 2-files
my $done = 0;

$state = 0;

# if reading from STDIN, we assume that we are
# getting git log as input
if (key_ready())
{

    #my $dummyfh; # don't care about writing
    #($fh,$dummyfh) = FileHandle::pipe;
    $fh->fdopen(*STDIN, 'r');
}
else
{
    $fh->open("LC_ALL=C git log --pretty --numstat --summary|")
	or die("Cannot execute git log...$!\n");
}

while (my $_l = <$fh>) {
    #print STDERR "debug ($state, " . (@@date ? (strftime "%Y-%m-%d", @@date) : "") . "): `$_'\n";
    if ($state == 0) {
	if ($_l =~ m,^Author: (.*),) {
	    $author = $1;
	}
	if ($_l =~ m,^Date: (.*),) {
	    @@date = strptime($1);
	}
	$state = 1 if ($_l =~ m,^$, and $author and (@@date+0>0));
    } elsif ($state == 1) {
        # * modifying our input text is a bad choice
        #   let's make a copy of it first, then we remove spaces 
        # * if we meet a "merge branch" statement, we need to start
        #   over and find a real entry
        # Luis Mondesi <lemsx1@@gmail.com>
        my $_s = $_l;
	$_s =~ s/^    //g;
        if ($_s =~ m/^Merge branch/)
        {
            $state=0;
            next;
        }
	$comment = $comment . $_s;
	$state = 2 if ($_l =~ m,^$,);
    } elsif ($state == 2) {
	if ($_l =~ m,^([0-9]+)\t([0-9]+)\t(.*)$,) {
	    push @@files, $3;
	}
	$done = 1 if ($_l =~ m,^$,);
    }

    if ($done) {
	print (strftime "%Y-%m-%d  $author\n\n", @@date);

	my $files = join (", ", @@files);
	$files = mywrap ("\t", "\t", "* $files"), ": ";

	if (index($comment, EMPTY_LOG_MESSAGE) > -1 ) {
	    $comment = "[no log message]\n";
	}

	my $files_last_line_len = 0;
	$files_last_line_len = last_line_len($files) + 1;
	my $msg = wrap_log_entry($comment, "\t", 69-$files_last_line_len, 69);

	$msg =~ s/[ \t]+\n/\n/g;

	print "$files: $msg\n";

	@@date = ();
	$author = "";
	@@files = ();
	$comment = "";

	$state = 0;
	$done = 0;
    }
}

if (@@date + 0)
{
    print (strftime "%Y-%m-%d  $author\n\n", @@date);
    my $msg = wrap_log_entry($comment, "\t", 69, 69);
    $msg =~ s/[ \t]+\n/\n/g;
    print "\t* $msg\n";
}
@


