[Debian-l10n-commits] r1181 - in /dl10n/trunk: Changelog lib/Debian/L10n/Db.pm

nekral-guest at users.alioth.debian.org nekral-guest at users.alioth.debian.org
Mon Aug 11 21:27:38 UTC 2008


Author: nekral-guest
Date: Mon Aug 11 21:27:38 2008
New Revision: 1181

URL: http://svn.debian.org/wsvn/?sc=1&rev=1181
Log:
	* lib/Debian/L10n/Db.pm: if a $type, $file, and $statusline are
	specified, remove the lines older than the specified $statusline
	for the given $file and $type
	* lib/Debian/L10n/Db.pm: del_status() always uses $statusline.
	Remove the specified line only if $file and $type are not defined.

Modified:
    dl10n/trunk/Changelog
    dl10n/trunk/lib/Debian/L10n/Db.pm

Modified: dl10n/trunk/Changelog
URL: http://svn.debian.org/wsvn/dl10n/trunk/Changelog?rev=1181&op=diff
==============================================================================
--- dl10n/trunk/Changelog (original)
+++ dl10n/trunk/Changelog Mon Aug 11 21:27:38 2008
@@ -1,3 +1,11 @@
+2008-08-11  Nicolas François  <nicolas.francois at centraliens.net>
+
+	* lib/Debian/L10n/Db.pm: if a $type, $file, and $statusline are
+	specified, remove the lines older than the specified $statusline
+	for the given $file and $type
+	* lib/Debian/L10n/Db.pm: del_status() always uses $statusline.
+	Remove the specified line only if $file and $type are not defined.
+
 2008-08-11  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* html/l10n.css: Added support for TODO (TAF are still supported).

Modified: dl10n/trunk/lib/Debian/L10n/Db.pm
URL: http://svn.debian.org/wsvn/dl10n/trunk/lib/Debian/L10n/Db.pm?rev=1181&op=diff
==============================================================================
--- dl10n/trunk/lib/Debian/L10n/Db.pm (original)
+++ dl10n/trunk/lib/Debian/L10n/Db.pm Mon Aug 11 21:27:38 2008
@@ -362,7 +362,7 @@
 sub del_status {
     my ($db,$pkg,$type,$file,$statusline) = @_;
 
-    if ($statusline) {
+    if (not defined $file and not defined $type) {
 	my $ok;
 	for (my $i=0; $i < @{$db->{data}->{$pkg}->{STATUS}}; $i++) {
 	    my @a = @$statusline;
@@ -380,7 +380,25 @@
 	print "Cannot del_status, statusline not found in package $pkg\n" unless $ok;
     } else {
 	my $found = 0;
+	my $linefound = 0;
+	$linefound = 1 if not defined $statusline;
+
+	if (defined $db->{data}->{$pkg}->{STATUS}) {
 	for (my $i=@{$db->{data}->{$pkg}->{STATUS}}; $i > 0; $i--) {
+	    # If a specific statusline was specified, do not remove lines more recent that this statusline.
+	    if ($linefound == 0) {
+		my $ok = 1;
+		my @a = @$statusline;
+		my @b = @{$db->{data}->{$pkg}->{STATUS}->[$i-1]};
+		while (scalar @a) {
+		    next if (shift(@a) eq shift(@b));
+		    $ok = 0;
+		    last;
+		}
+		$linefound = 1 if $ok;
+	    }
+	    next unless $linefound;
+
 	    my @b = @{$db->{data}->{$pkg}->{STATUS}->[$i-1]};
 	    if (    ($b[0] eq $type)
 	        and ($b[1] eq $file)) {
@@ -388,6 +406,7 @@
 		splice @{$db->{data}->{$pkg}->{STATUS}}, $i-1, 1;
 	    }
 	}
+	}
 	print "Cannot del_status, $type/$file not found in package $pkg\n" unless $found;
     }
 




More information about the Debian-l10n-commits mailing list