+ my ($files, $pages, $new, $internal_new, $del, $internal_del, $changed, $internal_changed);
+ 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);
+ }
+ else {
+ ($files, $pages)=find_src_files();
+ }
+ if ($want_find_changes) {
+ if (! defined($IkiWiki::lastrev) || ! length $IkiWiki::lastrev) {
+ $IkiWiki::lastrev=$IkiWiki::hooks{rcs}{rcs_get_current_rev}{call}->();
+ }
+ }
+ ($new, $internal_new)=find_new_files($files);
+ ($del, $internal_del)=find_del_files($pages);
+ ($changed, $internal_changed)=find_changed($files);
+ my %existingfiles;
+ run_hooks(needsbuild => sub {
+ my $ret=shift->($changed, [@$del, @$internal_del]);
+ if (ref $ret eq 'ARRAY' && $ret != $changed) {
+ if (! %existingfiles) {
+ foreach my $f (@$files) {
+ $existingfiles{$f}=1;
+ }
+ }
+ @$changed=grep $existingfiles{$_}, @$ret;
+ }
+ });
+ my $oldlink_targets=calculate_old_links($changed, $del);
+
+ foreach my $file (@$changed) {