Subject: | Errors when deleting properties |
Date: | Wed, 28 Jan 2009 10:10:35 +0100 |
To: | bug-SVN-Dumpfilter [...] rt.cpan.org |
From: | Roland Mas <lolando [...] debian.org> |
Hi,
I'm using SVN::Dumpfilter 0.21 on Debian GNU/Linux unstable, with Perl
5.10. I'm trying to filter out some properties from an SVN
repository. The interesting part of my code is:
,----
| if (exists $header->{'Node-path'} && $header->{'Node-path'} eq 'trunk')
| {
| @k = keys %$prop ;
| foreach $k (@k) {
| if ($k =~ /^bzr:/) {
| delete $prop->{$k} ;
| $recalc = 1;
| }
| }
| }
`----
However, standard SVN::Dumpfilter doesn't like that, and whines
about undefined strings. I fixed that by not trying to stringify
deleted properties, with the following patch:
--- Dumpfilter.pm~ 2008-04-04 12:15:52.000000000 +0200
+++ Dumpfilter.pm 2009-01-28 09:43:32.000000000 +0100
@@ -549,6 +549,7 @@
# Print properties by given order
foreach my $key (@$proporder) {
+ next unless exists $prophash->{$key} ;
$props .= 'K '
. length($key)
. $NL
@@ -563,6 +564,7 @@
# Print now all remaining properties (if any)
foreach my $key ( sort keys %prop_notprinted ) {
+ next unless exists $prophash->{$key} ;
$props .= 'K '
. length($key)
. $NL
This doesn't seem to have any ill side-effects, but maybe I missed
something.
On an unrelated note, the example code from the POD doesn't work
as-is: $header->{Node-path} really should be $header->{'Node-path'}.
Thanks for the module, which is about to save my day :-)
Roland.
--
Roland Mas
Vampyres are just the same, the only real difference being that they can't
spell properly. -- in Carpe Jugulum (Terry Pratchett)