Add TODOs
[docutils/kirr.git] / sandbox / infrastructure / commit-email / commit-email.patch
blobebc9a1ae4da7349d8e02fae02b14b95266b22f85
1 --- tools/hook-scripts/commit-email.pl 2004-06-14 22:29:22.000000000 +0200
2 +++ tools/hook-scripts/commit-email.pl 2005-10-30 22:39:22.942246752 +0100
3 @@ -222,32 +222,16 @@
4 shift @svnlooklines;
5 my @log = map { "$_\n" } @svnlooklines;
7 -# Figure out what directories have changed using svnlook.
8 -my @dirschanged = &read_from_process($svnlook, 'dirs-changed', $repos,
9 - '-r', $rev);
11 -# Lose the trailing slash in the directory names if one exists, except
12 -# in the case of '/'.
13 -my $rootchanged = 0;
14 -for (my $i=0; $i<@dirschanged; ++$i)
15 - {
16 - if ($dirschanged[$i] eq '/')
17 - {
18 - $rootchanged = 1;
19 - }
20 - else
21 - {
22 - $dirschanged[$i] =~ s#^(.+)[/\\]$#$1#;
23 - }
24 - }
26 # Figure out what files have changed using svnlook.
27 @svnlooklines = &read_from_process($svnlook, 'changed', $repos, '-r', $rev);
29 # Parse the changed nodes.
30 +my @fileschanged;
31 my @adds;
32 my @dels;
33 my @mods;
34 +my $rootchanged = 0;
35 foreach my $line (@svnlooklines)
37 my $path = '';
38 @@ -261,6 +245,12 @@
39 $path = $2;
42 + push(@fileschanged, $path);
43 + if ($path eq '/')
44 + {
45 + $rootchanged = 1;
46 + }
48 if ($code eq 'A')
50 push(@adds, $path);
51 @@ -288,11 +278,11 @@
52 # there's no point in collapsing the directories, and only if more
53 # than one directory was modified.
54 my $commondir = '';
55 -if (!$rootchanged and @dirschanged > 1)
56 +if (!$rootchanged and @fileschanged > 1)
58 - my $firstline = shift @dirschanged;
59 + my $firstline = shift @fileschanged;
60 my @commonpieces = split('/', $firstline);
61 - foreach my $line (@dirschanged)
62 + foreach my $line (@fileschanged)
64 my @pieces = split('/', $line);
65 my $i = 0;
66 @@ -306,28 +296,28 @@
67 $i++;
70 - unshift(@dirschanged, $firstline);
71 + unshift(@fileschanged, $firstline);
73 if (@commonpieces)
75 $commondir = join('/', @commonpieces);
76 - my @new_dirschanged;
77 - foreach my $dir (@dirschanged)
78 + my @new_fileschanged;
79 + foreach my $file (@fileschanged)
81 - if ($dir eq $commondir)
82 + if ($file eq "$commondir/")
84 - $dir = '.';
85 + $file = '.';
87 else
89 - $dir =~ s#^$commondir/##;
90 + $file =~ s#^$commondir/##;
92 - push(@new_dirschanged, $dir);
93 + push(@new_fileschanged, $file);
95 - @dirschanged = @new_dirschanged;
96 + @fileschanged = @new_fileschanged;
99 -my $dirlist = join(' ', @dirschanged);
100 +my $filelist = join(' ', @fileschanged);
102 ######################################################################
103 # Assembly of log message.
104 @@ -367,7 +357,7 @@
106 my $match_re = $project->{match_re};
107 my $match = 0;
108 - foreach my $path (@dirschanged, @adds, @dels, @mods)
109 + foreach my $path (@adds, @dels, @mods)
111 if ($path =~ $match_re)
113 @@ -390,16 +380,20 @@
115 if ($commondir ne '')
117 - $subject = "r$rev - in $commondir: $dirlist";
118 + $subject = "r$rev - in $commondir: $filelist";
120 else
122 - $subject = "r$rev - $dirlist";
123 + $subject = "r$rev - $filelist";
125 if ($subject_prefix =~ /\w/)
127 $subject = "$subject_prefix $subject";
129 + if(length($subject) > 900)
131 + $subject = substr($subject, 0, 896) . " ...";
133 my $mail_from = $author;
135 if ($from_address =~ /\w/)