diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-03-26 02:30:44 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-03-26 02:30:44 +0000 |
commit | 90923561734f17ad777237bed5e7b40e682344eb (patch) | |
tree | 8d1ef394472f0e36f167dc5683c6d368b2cb61d2 /IkiWiki | |
parent | 3903c2ce3a72d1fcd941f0e24a6780eaf15aa33a (diff) | |
download | ikiwiki-90923561734f17ad777237bed5e7b40e682344eb.tar ikiwiki-90923561734f17ad777237bed5e7b40e682344eb.tar.gz |
added --getctime
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Rcs/SVN.pm | 34 | ||||
-rw-r--r-- | IkiWiki/Rcs/Stub.pm | 6 | ||||
-rw-r--r-- | IkiWiki/Wrapper.pm | 8 |
3 files changed, 40 insertions, 8 deletions
diff --git a/IkiWiki/Rcs/SVN.pm b/IkiWiki/Rcs/SVN.pm index 946412320..083b869df 100644 --- a/IkiWiki/Rcs/SVN.pm +++ b/IkiWiki/Rcs/SVN.pm @@ -1,10 +1,12 @@ -#!/usr/bin/perl -T +#!/usr/bin/perl # For subversion support. use warnings; use strict; package IkiWiki; + +my $svn_log_infoline=qr/^r(\d+)\s+\|\s+([^\s]+)\s+\|\s+(\d+-\d+-\d+\s+\d+:\d+:\d+\s+[-+]?\d+).*/; sub svn_info ($$) { #{{{ my $field=shift; @@ -107,7 +109,6 @@ sub rcs_recentchanges ($) { #{{{ my ($svn_base)=$svn_url=~m!(/trunk(?:/.*)?)$!; my $div=qr/^--------------------+$/; - my $infoline=qr/^r(\d+)\s+\|\s+([^\s]+)\s+\|\s+(\d+-\d+-\d+\s+\d+:\d+:\d+\s+[-+]?\d+).*/; my $state='start'; my ($rev, $user, $when, @pages, @message); foreach (`LANG=C svn log --limit $num -v '$svn_url'`) { @@ -115,7 +116,7 @@ sub rcs_recentchanges ($) { #{{{ if ($state eq 'start' && /$div/) { $state='header'; } - elsif ($state eq 'header' && /$infoline/) { + elsif ($state eq 'header' && /$svn_log_infoline/) { $rev=$1; $user=$2; $when=concise(ago(time - str2time($3))); @@ -166,4 +167,31 @@ sub rcs_recentchanges ($) { #{{{ return @ret; } #}}} +sub rcs_getctime () { #{{{ + eval q{use Date::Parse}; + foreach my $page (keys %pagectime) { + my $file="$config{srcdir}/$pagesources{$page}"; + my $child = open(SVNLOG, "-|"); + if (! $child) { + exec("svn", "log", $file) || error("svn log $file failed to run"); + } + + my $date; + while (<SVNLOG>) { + if (/$svn_log_infoline/) { + $date=$3; + } + } + close SVNLOG || warn "svn log $file exited $?"; + + if (! defined $date) { + warn "failed to parse svn log for $file\n"; + next; + } + + $pagectime{$page}=$date=str2time($date); + debug("found ctime ".localtime($date)." for $page"); + } +} #}}} + 1 diff --git a/IkiWiki/Rcs/Stub.pm b/IkiWiki/Rcs/Stub.pm index d3b72b5ea..d2a6ad003 100644 --- a/IkiWiki/Rcs/Stub.pm +++ b/IkiWiki/Rcs/Stub.pm @@ -1,4 +1,4 @@ -#!/usr/bin/perl -T +#!/usr/bin/perl # Stubs for no revision control. use warnings; @@ -23,4 +23,8 @@ sub rcs_add ($) { sub rcs_recentchanges ($) { } +sub rcs_getctime () { + error "getctime not implemented"; +} + 1 diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index 4966c453a..85d259117 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -38,7 +38,7 @@ EOF $configstring=~s/\\/\\\\/g; $configstring=~s/"/\\"/g; - open(OUT, ">ikiwiki-wrap.c") || error("failed to write ikiwiki-wrap.c: $!");; + open(OUT, ">$wrapper.c") || error("failed to write $wrapper.c: $!");; print OUT <<"EOF"; /* A wrapper for ikiwiki, can be safely made suid. */ #define _GNU_SOURCE @@ -66,10 +66,10 @@ $envsave } EOF close OUT; - if (system("gcc", "ikiwiki-wrap.c", "-o", $wrapper) != 0) { - error("failed to compile ikiwiki-wrap.c"); + if (system("gcc", "$wrapper.c", "-o", $wrapper) != 0) { + error("failed to compile $wrapper.c"); } - unlink("ikiwiki-wrap.c"); + unlink("$wrapper.c"); if (defined $config{wrappermode} && ! chmod(oct($config{wrappermode}), $wrapper)) { error("chmod $wrapper: $!"); |