3 $commitrange = shift @ARGV;
5 print STDERR
"Enter commitrange: ";
7 $commitrange =~ s/\s*(.*?)\s+/$1/;
10 $syncdate = shift @ARGV;
12 print STDERR
"Enter syncdate YYYY-MM-DD: ";
14 $syncdate =~ s/\s*(.*?)\s+/$1/;
19 print STDERR
'Enter kind ("lisp" or "texi" or "card" or press RET): ';
21 $kind =~ s/\s*(.*?)\s+/$1/;
22 $kind =~ s/"(.*?)"/$1/;
25 if ($kind ne "lisp" and $kind ne "texi" and $kind ne "card"
27 die "Invalid Changelog kind";
30 # Run git log to get the commits the messages
31 open IN
,"git log $commitrange|";
34 @commits = split(/^(?=commit)/m,$log);
36 for $i (0..$#commits) {
37 $entry = ""; $tiny = "";
38 $commit = $commits[$i];
39 $author = $1 if $commit=~/^Author: ([^\n]+)/m;
40 $date = $1 if $commit=~/^Date: ([^\n]+)/m;
41 $entry = $1 if $commit=~/^([ \t]*\* [^\f]*?)(\n[ \t]*\n([^*]|\Z)|\Z)/m;
42 $tiny = " (tiny change)" if $commit =~ /TINYCHANGE/;
44 # split author into name and address
45 if ($author =~ /(.*?)\s+(<.*?>)/) {
49 warn "No name/address";
55 # Fix the path when directories have been omitted
57 $entry =~ s/^([ \t]*\* )([-a-zA-Z]+\.el)/$1lisp\/$2/mg
;
58 $entry =~ s/^([ \t]*\* )(org[a-z]*\.texi?)/$1doc\/$2/mg
;
60 # remove stuff which is not for this output
62 remove_parts
("contrib/","testing/","xemacs/");
63 remove_parts
("Makefile","README");
65 if ($kind eq "lisp") { remove_parts
("doc/") }
66 if ($kind eq "texi") { remove_parts
("lisp/","doc/orgcard","doc/orgguide") }
67 if ($kind eq "card") { remove_parts
("lisp/","doc/org\\.","doc/orgguide") }
69 # indent each line by 1 TAB
70 $entry =~ s/^[ \t]*/\t/gm;
72 # Add empty lines if there are several files in there
73 $entry =~ s/(\n[ \t]+\* )/\n$1/g;
75 # remove blocks of more than one empty line
76 while ($entry =~s/\n[ \t]*\n[ \t]*\n/\n/g) {};
78 # remove/replace parts of the path
80 $entry =~ s/^([ \t]+\* )lisp\//$1/mg
;
81 $entry =~ s/^([ \t]+\* )doc\/orgcard/$1 refcards\
/orgcard/mg;
82 $entry =~ s/^([ \t]+\* )doc\//$1misc\
//mg;
84 # remove empty space at beginning and end
85 $entry =~ s/\A\s*/\t/;
86 $entry =~ s/\s*\Z/\n/;
88 # If there is anything left in the entry, print it
90 print "$syncdate $name $address$tiny\n\n$entry\n";
97 $re = "^[ \t]*\\*\\s+" . $path . "[^\\000]*?(?=^[ \\t]*\\*|\\Z)";
98 $entry =~ s/$re/\n$1/mg;