MBS-6787: Do not load ISWCs multiple times for 'merge work' edits
MBS-6782: Correct set_release_group_first_release_date when all release events are deleted

If all release events for all releases are deleted, then the first
release date for a release group should be null. However, by using
an inner join, rather than a left join, we were not changing the
first release date at all. This commit uses a left join, and also
introduces some PgTAP tests for the desired behavior.
MBS-6782: Add an upgrade script to fix release group dates
MBS-4453: Clean join-phrases before finding existing artist credits

Previously we were trying to find existing artist credits based on
the input to the method, and then if there was no match we would
insert a cleaned artist credit - but this can be different from what
we originally searched with. Instead, search for the cleaned version
first.
MBS-4453: Rewrite ArtistCredit->merge_artists to use find_or_insert

Previously when merging artists, we just renamed some artist_credit_name
rows into the new artist name. However, this didn't take into account
the possibility that this new artist credit already exists, and
would create a duplication.

Now instead of renaming individual artist_credit_name rows, we use
find_or_insert to find entire artist credits. If the artist_credit id
differs from what we had before, then everything pointing to the old
artist credit is changed to point to the new artist credit, and the
old artist credit is deleted.
MBS-5647: Correct release header display in release editor

The template for the duplicates tab assigns to a variable called
release. For some (inane) reason, Template Toolkit doesn't have
lexical scoping - so this is a global variable. Furthermore, the
content of a wrapper is evaluated *before* the wrapper. Hence the
end result is that when the wrapper is ran, the release variable
is set, so the layout wrapper assumes the user is editing a release.

This commit uses a different variable name, and hopes that no one
ever needs to use this variable name again.
MBS-6067: Always work with an inc object

If the user browses /artist/mbid?query=foo, it should really be an
incorrect request - because you can't query an MBID. However, making
that so is unfortunately a lot of work. In the meantime, I am
addressing a current exception that gets through.

Because ?query= does match a valid branch of inc arguments, there
is no failure when parsing the request - it just means nothing
ever assigns to $inc. However, the OAuth checks assume that $inc
is a hash reference, and autovivification turns $inc into an empty
hash reference.

Later, various other parts of the web service assume that $inc exists
and is an object, not a hash reference - and thus there is an exception.
I've instead opted to have $inc default to be an empty inc object.
Merge branch 'mbs-6787' into beta
Merge branch 'mbs-6782' into beta
Merge branch 'mbs-6067' into beta
Merge branch 'mbs-5647' into beta
Merge branch 'mbs-4453' into beta