X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/654530fa8bb0937123ed526e3093170ef23f5295..c04a26f3e70d654ccec5542daf8425e44cb5bac8:/IkiWiki/Render.pm diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 60424bbda..825c077da 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -6,7 +6,7 @@ use warnings; use strict; use IkiWiki; -my (%backlinks, %rendered); +my (%backlinks, %rendered, %scanned); our %brokenlinks; my $links_calculated=0; @@ -154,6 +154,8 @@ sub genpage ($$) { sub scan ($) { my $file=shift; + return if $phase > PHASE_SCAN || $scanned{$file}; + $scanned{$file}=1; debug(sprintf(gettext("scanning %s"), $file)); @@ -824,17 +826,16 @@ sub gen_autofile ($$$) { return 1; } -sub want_find_changes { - $config{only_committed_changes} && - exists $IkiWiki::hooks{rcs}{rcs_find_changes} && - exists $IkiWiki::hooks{rcs}{rcs_get_current_rev} -} - sub refresh () { + $phase = PHASE_SCAN; + srcdir_check(); run_hooks(refresh => sub { shift->() }); my ($files, $pages, $new, $internal_new, $del, $internal_del, $changed, $internal_changed); - if (! $config{rebuild} && want_find_changes() && defined $IkiWiki::lastrev) { + my $want_find_changes=$config{only_committed_changes} && + exists $IkiWiki::hooks{rcs}{rcs_find_changes} && + exists $IkiWiki::hooks{rcs}{rcs_get_current_rev}; + if (! $config{rebuild} && $want_find_changes && defined $IkiWiki::lastrev && length $IkiWiki::lastrev) { my ($changed_raw, $del_raw); ($changed_raw, $del_raw, $IkiWiki::lastrev) = $IkiWiki::hooks{rcs}{rcs_find_changes}{call}->($IkiWiki::lastrev); ($files, $pages)=process_changed_files($changed_raw, $del_raw); @@ -842,8 +843,8 @@ sub refresh () { else { ($files, $pages)=find_src_files(); } - if (want_find_changes()) { - if (! defined($IkiWiki::lastrev)) { + if ($want_find_changes) { + if (! defined($IkiWiki::lastrev) || ! length $IkiWiki::lastrev) { $IkiWiki::lastrev=$IkiWiki::hooks{rcs}{rcs_get_current_rev}{call}->(); } } @@ -879,7 +880,13 @@ sub refresh () { } calculate_links(); - + + # At this point it becomes OK to start matching pagespecs. + $phase = PHASE_RENDER; + # Save some memory: we no longer need to keep track of which pages + # we've scanned + %scanned = (); + remove_del(@$del, @$internal_del); foreach my $file (@$changed) { @@ -943,6 +950,10 @@ sub commandline_render () { loadindex(); unlockwiki(); + # This function behaves as though it's in the render phase; + # all other files are assumed to have been scanned last time. + $phase = PHASE_RENDER; + my $srcfile=possibly_foolish_untaint($config{render}); my $file=$srcfile; $file=~s/\Q$config{srcdir}\E\/?//;