Closed Bug 622993 Opened 14 years ago Closed 14 years ago

Bugzilla::Util::diff_arrays could diff also object arrays based on an object attribute

Categories

(Bugzilla :: Bugzilla-General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 620827

People

(Reporter: timello, Assigned: timello)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch v1 (obsolete) — Splinter Review
That would avoid dealing with map/grep all the time for comparing object arrays.
Comment on attachment 501152 [details] [diff] [review] v1 >=== modified file 'Bugzilla/Util.pm' > next if ($newv eq ''); You are comparing an object with a string? >+ if (defined $attrib and $oldv->$attrib eq $newv->$attrib) { >+ $newv = $oldv = undef; >+ } >+ elsif ($oldv eq $newv) { > $newv = $oldv = ''; > } The first "if" statement is incorrect. If $attrib is defined, but $oldv->$attrib is not equal to $newv->$attrib, you would jump to the "elsif" block.
Attachment #501152 - Flags: review-
Attached patch v2Splinter Review
Attachment #501152 - Attachment is obsolete: true
Attachment #501163 - Flags: review?(LpSolit)
This will also need to include some code that actually uses this form of diff_arrays, in order for us to check it in. Also, I'm pretty sure that we'd always be comparing by id--perhaps we should just start with a diff_arrays that always compares objects by id?
Comment on attachment 501163 [details] [diff] [review] v2 Per mkanat's comment, nothing uses the new feature yet. I'm not sure about ->id being the most used method for comparison, though.
Attachment #501163 - Flags: review?(LpSolit)
(In reply to comment #4) > Comment on attachment 501163 [details] [diff] [review] > v2 > > Per mkanat's comment, nothing uses the new feature yet. I'm not sure about ->id > being the most used method for comparison, though. Ok, we are going to 'use' this in the remove see also patch, so this will be implemented there.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: