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/;
23 if ($kind ne "lisp" and $kind ne "texi" and $kind ne "card"
25 die "Invalid Changelog kind";
29 # Run git log to get the commits the messages
30 open IN
,"git log $commitrange|";
33 @commits = split(/^(?=commit)/m,$log);
35 for $i (0..$#commits) {
36 $entry = ""; $tiny = "";
37 $commit = $commits[$i];
38 $author = $1 if $commit=~/^Author: ([^\n]+)/m;
39 $date = $1 if $commit=~/^Date: ([^\n]+)/m;
40 $entry = $1 if $commit=~/^([ \t]*\* [^\f]*?)(\n[ \t]*\n([^*]|\Z)|\Z)/m;
41 $tiny = " (tiny change)" if $commit =~ /TINYCHANGE/;
43 # split author into name and address
44 if ($author =~ /(.*?)\s+(<.*?>)/) {
48 warn "No name/address";
54 # Fix the path when directories have been omitted
56 $entry =~ s/^([ \t]*\* )([-a-zA-Z]+\.el)/$1lisp\/$2/mg
;
57 $entry =~ s/^([ \t]*\* )(org[a-z]*\.texi?)/$1doc\/$2/mg
;
59 # remove stuff which is not for this output
61 remove_parts
("contrib/","testing/","xemacs/");
62 remove_parts
("Makefile","README");
64 if ($kind eq "lisp") { remove_parts
("doc/") }
65 if ($kind eq "texi") { remove_parts
("lisp/","doc/orgcard","doc/orgguide") }
66 if ($kind eq "card") { remove_parts
("lisp/","doc/org\\.","doc/orgguide") }
68 # indent each line by 1 TAB
69 $entry =~ s/^[ \t]*/\t/gm;
71 # Add empty lines if there are several files in there
72 $entry =~ s/(\n[ \t]+\* )/\n$1/g;
74 # remove blocks of more than one empty line
75 while ($entry =~s/\n[ \t]*\n[ \t]*\n/\n/g) {};
77 # remove/replace parts of the path
79 $entry =~ s/^([ \t]+\* )lisp\//$1/mg
;
80 $entry =~ s/^([ \t]+\* )doc\/orgcard/$1 refcards\
/orgcard/mg;
81 $entry =~ s/^([ \t]+\* )doc\//$1misc\
//mg;
83 # remove empty space at beginning and end
84 $entry =~ s/\A\s*/\t/;
85 $entry =~ s/\s*\Z/\n/;
87 # If there is anything left in the entry, print it
89 print "$syncdate $name $address$tiny\n\n$entry\n";
96 $re = "^[ \t]*\\*\\s+" . $path . "[^\\000]*?(?=^[ \\t]*\\*|\\Z)";
97 $entry =~ s/$re/\n$1/mg;