Commit b1317e9f authored by bugreport%peshkin.net's avatar bugreport%peshkin.net

Bug 226411: make DiffStrings handle fields with duplicate values

patch by jouni r=joel,myk a=justdave
parent 4f7b9f55
...@@ -1404,20 +1404,20 @@ sub DiffStrings { ...@@ -1404,20 +1404,20 @@ sub DiffStrings {
my @old = split(" ", $oldstr); my @old = split(" ", $oldstr);
my @new = split(" ", $newstr); my @new = split(" ", $newstr);
my (@remove, @add) = (); # For each pair of (old, new) entries:
# If they're equal, set them to empty. When done, @old contains entries
# Find values that were removed # that were removed; @new contains ones that got added.
foreach my $value (@old) {
push (@remove, $value) if !grep($_ eq $value, @new); foreach my $oldv (@old) {
} foreach my $newv (@new) {
next if ($newv eq '');
# Find values that were added if ($oldv eq $newv) {
foreach my $value (@new) { $newv = $oldv = '';
push (@add, $value) if !grep($_ eq $value, @old); }
}
} }
my $removed = join (", ", grep { $_ ne '' } @old);
my $removed = join (", ", @remove); my $added = join (", ", grep { $_ ne '' } @new);
my $added = join (", ", @add);
return ($removed, $added); return ($removed, $added);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment