From: Joey Hess Date: Sat, 27 Feb 2010 21:26:13 +0000 (-0500) Subject: Add force_overwrite setting to make setup automator overwrite existing files/directories. X-Git-Tag: 3.20100302~17 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a12c386c86d000971125d70bf22213fd9595ed45;p=ikiwiki.git Add force_overwrite setting to make setup automator overwrite existing files/directories. This can be useful if you're driving the setup automator from another program. --- diff --git a/IkiWiki/Setup/Automator.pm b/IkiWiki/Setup/Automator.pm index 9fee4dcb7..79a610e20 100644 --- a/IkiWiki/Setup/Automator.pm +++ b/IkiWiki/Setup/Automator.pm @@ -40,17 +40,19 @@ sub import (@) { my $this=shift; IkiWiki::Setup::merge({@_}); - # Avoid overwriting any existing files. - foreach my $key (qw{srcdir destdir repository dumpsetup}) { - next unless exists $config{$key}; - my $add=""; - my $dir=IkiWiki::dirname($config{$key})."/"; - my $base=IkiWiki::basename($config{$key}); - while (-e $dir.$add.$base) { - $add=1 if ! $add; - $add++; + if (! $config{force_overwrite}) { + # Avoid overwriting any existing files. + foreach my $key (qw{srcdir destdir repository dumpsetup}) { + next unless exists $config{$key}; + my $add=""; + my $dir=IkiWiki::dirname($config{$key})."/"; + my $base=IkiWiki::basename($config{$key}); + while (-e $dir.$add.$base) { + $add=1 if ! $add; + $add++; + } + $config{$key}=$dir.$add.$base; } - $config{$key}=$dir.$add.$base; } # Set up wrapper diff --git a/debian/changelog b/debian/changelog index 1960a1226..bdbd818e1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ ikiwiki (3.20100213) UNRELEASED; urgency=low * Rebuild wikis on upgrade to this version to get the comment counts added to existing pages. * Loosen regexp, to allow empty quoted parameters in directives. + * Add force_overwrite setting to make setup automator overwrite existing + files/directories. -- Joey Hess Sun, 14 Feb 2010 17:02:10 -0500