Previously the selection of which Weblink that should be used for
inline commitlinks (like patchset, parent) was determined by a number
of assumptions:
(Known weblinks that links to codebrowsers are Gitweb and Gitiles)
* It was assumed that the name of the weblink to gitiles would be
'gitiles'.
The default name has since changed to 'browse', however many
installations have configured the name to be the old default
'gitiles and therefore we keep this name as an identifier of a
weblink that links to a codebrowser.
* It was assumed that there would never be more than one weblink
available to any of these code-browsers. If weblinks for both
Gitiles and Gitweb was available PG would always select Gitweb
for inline commitlinks.
Use ServerInfo.gerrit.primaryWeblinkName setting to select
codebrowser weblink for inline commit links.
If primaryWeblinkName is not set try to find a codebrowser weblink
by searching for known codebrowser weblinks in the order
(Gitiles first):
1. weblink.name == 'gitiles' - Old default Gitiles name
2. weblink.name == 'browse' - Current default Gitiles name
3. weblink.name == 'gitweb'
* None of the known codebrowser weblinks were visible in
changeMetadata.links. Since it was assumed that there would never
be more than one weblink available that linked to a codebrowser,
all known weblinks linking to codebrowsers were excluded from this
collection, even if they were not selected for inline commitlinks.
Since selection of the weblink that is used for inline commitlinks
is now well defined we can safely remove exactly that one from
the available weblinks when populating changeMetadata.links which
will enable for having weblinks to both Gitweb and Gitiles (when
named 'gitiles') being displayed on the Changescreen. The primary
as inline commitlinks and all other in changeMetadata.links.
Bug: Issue 10355
Change-Id: If3aaa629d06ff77f1faff0dff15f68fe1adad469