Mark ALREADY_MERGED changes as merged in the DB and run hooks

If a change in the merge queue is marked ALREADY_MERGED, it is likely a
result of a bug in the merge code.  It means the change has been merged,
but neither properly marked as such in the DB nor propagated to hooks for
sending email notifications or being mentioned in stream-events.

Calling setMerged() instead of setMergedPatchSet() properly marks the
change as merged in the database and runs hooks for sending emails and
events.

This is an improved version of I44548cce039e303a86d579b0b0d76b12ad9bdcfb
and fix for issue 2044.

Bug: issue 2044
Change-Id: I4e95a74e58ff51a54ed54a02298c719e19f6fd0d
fix: NoOp score not displayed for open changes

Score for NoBlock/NoOp category doesn't get displayed for open changes
on All --> Open or My --> Changes. For such category, none of the label
flags i.e. recommended, liked, approved or rejected flags are set for
open changes.

Further, abandoned and merged change display different images for same
score e.g. If a -1 has been assigned, Abandoned change displays a "X"
whereas a Merged change displays "-1". A Merged can be rejected for a
NoBlock or NoOp category type.

Bug: Issue 2056
Change-Id: I29cfa02f4a43ef6be1cb94614ed75b979a84f7af
(cherry picked from commit e88304abce3ceb9c7b93040363c4db3219459b0a)
Fix: RepoCommandLink's text is wrong

The title of the "repo download" link was mistakenly set to "checkout"
during refactoring in commit cbc629f4f4ce6bd9071a540cb026ef8a9d53382c.

Change it to the correct "repo download" title.

Bug: Issue 2093
Change-Id: I4c30d0fedf56942f741edbbfaa7505052e5e370c
Merge branch 'stable-2.6' into stable-2.7

* stable-2.6:
  Fix: RepoCommandLink's text is wrong
  fix: NoOp score not displayed for open changes

Change-Id: Ib7ba9c2030740422cbda5d95964ab6aab1e96cf2
Fix reenabling of plugins

e51c428fe5ef3960f4990e1c0471d067783d4718 broke the unregistering of plugin
owned SSH command by passing wrong instance to the ConcurrentMap.remove()
function. Currently plugins can not be reenabled.

Change-Id: I2b2dfe6ffe89a426a03d945d9695bc35e7fe9f1a
Merge branch 'stable-2.6' into stable-2.7

* stable-2.6:
  Fix reenabling of plugins
Fix example for 'test-submit rule' in Prolog cookbook

Since commit b1f730b89458d9d094bc93f3d328ad744c39bbb5 it is
'test-submit rule' and not anymore 'test-submit-rule'.

Change-Id: I4c32893afa1410af5347a8b659c5811aac218f63
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
NPE when deleting draft patch set when previous draft already deleted

If a change has 3 patch sets, all of which are drafts, and draft
patch set 2 is deleted, attempting to delete draft patch set 3 (the
current patch set) will result in NPE.

The reason is that on deleting a draft patch set which is the current
patch set, the current patch set is set to the previous patch set
whose ID is calculated by subtracting 1 from the deleted patch set ID.

This does not work if the previous patch set has already been deleted.

Instead, set the current patch set to the highest patch set ID that
is available.

Bug: Issue 2128
Change-Id: I235d4d943a5525e8223218a97f4702e26f09a69e
Remove documentation links from admin page

The links for Change-Id and Signed-off-by documentation in the
admin page are hard-coded to specific versions on the the
gerrit-documentation.googlesource.com site.

This causes two problems.  Firstly, they are not links to local
versions, and secondly it is easy to forget to update them and
they become out of date.

Remove the links.  Administrators should be capable of finding
the relevant pages in the documentation by themselves.

Bug: Issue 2127
Change-Id: Idd4ddd1126e0631615d564173a02e3047aa87559
Merge "NPE when deleting draft patch set when previous draft already deleted" into stable-2.6
Merge "Mark ALREADY_MERGED changes as merged in the DB and run hooks" into stable-2.7
Fix change stuck in SUBMITTED state but actually merged

This behavior is caused by submitting a commit that has a tag.
Method MergeUtil.markCleanMerges is used by each merge strategy
to update the status of a change if it was a clean merge. It skips
commits that are identified as accepted and their entire ancestry
chain. If a commit is tagged, method MergeOp.getAlreadyAccepted
identifies it as accepted (even if it is not merged yet).
Fix prevents a commit that is referred by a tag to be included in
alreadyAccepted set. If such commit is already merged then it will
be covered anyway by adding heads to alreadyAccepted.

Add a corresponding test that pushes a commit with a tag

Bug: Issue 600
Change-Id: If00247b809b985eaf60ef5ef09fad0f475fb06b9
(cherry picked from commit b22ee233f1ef880cd84beb5939e332de1d7d704e)
Merge branch 'stable-2.6' into stable-2.7

* stable-2.6:
  Remove documentation links from admin page
  NPE when deleting draft patch set when previous draft already deleted
  Fix example for 'test-submit rule' in Prolog cookbook

Change-Id: Ib96358c1fe6a953d17e88fd9f5bd4832fd51334a
Merge "Merge branch 'stable-2.6' into stable-2.7" into stable-2.7
Fix installation of plugins

e51c428fe5ef3960f4990e1c0471d067783d4718 broke the unregistering of plugin
owned SSH command by passing wrong instance to the ConcurrentMap.remove()
function.

bae9e58ddd68992473307787fb01e022f5969fee was trying to fix it, but broke it
for the installation of plugins by throwing the `IllegalStateException` in case
the old registration handle wasn't found. But it's perfectly possible and even
wanted during plugin reloading: registration handle is replaced and the old one
cannot be found.

Moreover, bae9e58ddd68992473307787fb01e022f5969fee didn't fix all places:
the same bug in unregistering of SSH commands in
DispatchCommandProvider.replace() method wasn't fixed.

Change-Id: I21132d4f7aec58347acbf50d75a962cb8251201f
Merge branch 'stable-2.6' into stable-2.7

* stable-2.6:
  Fix installation of plugins

Change-Id: I6742a5cd3417633be2ad8347f8ebea2fdcc07b88
Set version to 2.7

Change-Id: I49a7fc97fd6d4f199c25774faa50ec4a826ae64a
Remove unused imports

Change-Id: I6066345e78290f7c2bb178006bc7a7545a6d1351
Fix: change list shows '1' instead of '-1' for label score.

If a user votes '-1', and then another user votes '+1' for a label, the
label will be shown as a red '1' in the change list instead of red '-1'.

Change the logic of setting the label score to handle this case properly.

Bug: Issue 2125
Change-Id: Icf32c11ddcda7a40ee162ac6829015b8fd1b3988
Fix documentation of query label operator

Two examples in the label query operator documentation were
using old syntax that does not work any more.

Update the examples with correct syntax.

Bug: Issue 2144
Change-Id: I53c04bc385603be1b4e62c94697146ab0bef8fb9