First commit! Scripts are ready
This commit is contained in:
commit
ae036887ef
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# error handler
|
||||||
|
exit_if_error() {
|
||||||
|
local exit_code=$1
|
||||||
|
shift
|
||||||
|
[[ $exit_code ]] && # do nothing if no error code passed
|
||||||
|
((exit_code != 0)) && { # do nothing if error code is 0
|
||||||
|
printf 'ERROR: %s\n' "$@" >&2 # we can use better logging here
|
||||||
|
exit "$exit_code" # we could also check to make sure
|
||||||
|
# error code is numeric when passed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '==== Write html blog ===='
|
||||||
|
|
||||||
|
perl log2html.pl>index.html
|
||||||
|
exit_if_error $? "Writing failed"
|
||||||
|
echo 'Done.'
|
||||||
|
|
||||||
|
echo '==== End of writing ===='
|
||||||
|
|
||||||
|
echo '==== Adding html in the commit ===='
|
||||||
|
git add --verbose index.html
|
||||||
|
echo '==== End of commit ===='
|
|
@ -0,0 +1,7 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
<body><pre>
|
||||||
|
</pre></body>
|
||||||
|
</html>
|
|
@ -0,0 +1,46 @@
|
||||||
|
# Script from Panike: https://gist.github.com/panike/811354.js
|
||||||
|
|
||||||
|
|
||||||
|
sub new_hl {
|
||||||
|
my @l = ();
|
||||||
|
return \@l;
|
||||||
|
}
|
||||||
|
|
||||||
|
@args = @ARGV;
|
||||||
|
shift @args;
|
||||||
|
print "<html>\n";
|
||||||
|
print "<head>\n";
|
||||||
|
print " <meta charset=\"utf-8\">\n";
|
||||||
|
print "</head>\n";
|
||||||
|
print "<body><pre>\n";
|
||||||
|
open REVLIST, "git log " . join(' ',@args) . " --topo-order --abbrev-commit --graph|" || die "Cannot get log";
|
||||||
|
while(<REVLIST>){
|
||||||
|
chomp;
|
||||||
|
if(/^Merge: /){
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if(/^commit/){
|
||||||
|
@list = split / /;
|
||||||
|
@tlist = @list;
|
||||||
|
print "commit <a name=\"$list[1]\"></a>$list[1]\n";
|
||||||
|
@list = @list[2 .. $#list];
|
||||||
|
foreach $key (@list) {
|
||||||
|
print "parent <a href=\"\#$key\">$key</a>\n";
|
||||||
|
if(!$commits{$key}){
|
||||||
|
$commits{$key}=new_hl;
|
||||||
|
}
|
||||||
|
push @{$commits{$key}}, $tlist[1];
|
||||||
|
}
|
||||||
|
foreach $key (@{$commits{$tlist[1]}}){
|
||||||
|
print "child <a href=\"\#$key\">$key</a>\n";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
s/</\</g;
|
||||||
|
s/>/\>/g;
|
||||||
|
print;
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "</pre></body>\n";
|
||||||
|
print "</html>\n";
|
||||||
|
|
Loading…
Reference in New Issue