Always use side effects of scanning the magic branch

Scanning the magic branch to prepare updates into the Git
batch produces two results, yet the method only returned one of
them. The first result is the newChanges collection. However
as a side-effect the method also updated replaceByChange and
replaceByCommit if a commit matched an existing change using
a Change-Id footer.

Drop the Java method return value and update all of the
collections by side effect.

Change-Id: I6673495e661876f8448611ce70207ef06ed3f31e
Replace parboiled with custom built version

Parboiled library was updated to work with asm 5 library: [1], [2].
Unfortunately this version wasn't released yet.

Since change If5009c676, Gerrit itself depends on asm 5.0.3.

Add a test to verify parboiled behaviour, and update to use a custom
built version of the latest master including support for asm 5.

[1] https://github.com/sirthias/parboiled/issues/76
[2] https://github.com/msrb/parboiled/commit/41b3c1282b0c913c77d205285ed0a607d1d6aa36

Change-Id: I9cbc8e8f685aa87056f8beb17ab40104b4a129a1
Remove pointless assertion for magicBranch validation

The code here requires magicBranch.ctl to be defined if
magicBranch.baseCommit was filled in by the caller. Gerrit
is never run with -ea, so the assert is useless.

Remove the check, as the code will just helpfully NPE
when magicBranch.ctl.getRefName() is invoked.

Change-Id: I3cc30a089464ac613cbf69c2c486acf53467b009
Remove the replaceByCommit map in ReceiveCommits

This map is not strictly necessary and can be removed to simplify the
logic. At one point in time the map was created to prevent a user
from uploading the same commit onto multiple changes, but this is
rather implausible with today's usage of Gerrit.

The primary location that might try to trigger this map check is
during processing of refs/for/{branch}. However, commits are visited
only once during this traversal as RevWalk tracks its output and never
produces the same commit again.

Change-Id: I7aef7b4eee8fa66fd8971fb19777fdc3685aa436
Use changeRefsById to track existing revisions

Most processing paths build up the same sets of ObjectIds, by scanning
through all refs/changes/ and copying them into a temporary set.

Reuse an existing map that is cached after first use and also supports
the autoCloseChanges code path.

It is unlikely that both refs/for/* and refs/heads/* are pushed at the
same time and need to use the map, so there may not be very much reuse
of the data structure within a single execution of ReceiveCommits.

This commit mostly shrinks the code a bit smaller by removing a very
simple redundant processing path.

Change-Id: If2ffd544c821d184593d729fe4ebef77de1860ee
Build both refsById and refsByChange at the same time

Instead of iterating one table from the other, build both at the same
time.  This reduces the constant factor for the table construction
algorithms slightly by avoiding traversal through the Multimap
internal structure just to make the second index of refsById.

Most processing paths that use one table will also use the other
table.  For example pushing to refs/for/master needs refsById to skip
known commits and then refsByChange to process replacement requests.

Change-Id: Ic3f71ec47cad5151456b1558f6095b87cd5d1776
ReceiveCommits: inline MagicBranchInput accessors

MagicBranchInput is a private internal struct of ReceiveCommits.
The accessor methods do nothing other than make a 2500 line class
longer than it needs to be. In the unlikely future event this is
ever exposed outside of ReceiveCommits the fields can be replaced
back with method calls.

Change-Id: Iadcf91be8fa794c237a505d4279affa70a919ba5
Merge changes from topic 'rc-cleanup'

* changes:
  ReceiveCommits: inline MagicBranchInput accessors
  Build both refsById and refsByChange at the same time
  Use changeRefsById to track existing revisions
  Remove the replaceByCommit map in ReceiveCommits
  Remove pointless assertion for magicBranch validation
  Always use side effects of scanning the magic branch
Move all FooterKeys into one place

We want to have the common FooterKeys be setup in one place, preventing
typo mistakes when reusing them.

Change-Id: Id31652bf0f0415c7b1a72df4f034910245a1d690
SideBySide2: Fix alignment for long insertion/deletion blocks

In commit 1dbc53126cafc0f553b709 the line-height was changed to
"normal", allowing for taller text lines. Padding for insertion
or deletion blocks was no longer tall enough, which caused the
two sides to stop aligning.

Correct this by computing the line height on the fly after the
UI is displayed and the browser was able to compute font metrics
to a sampling of 10 lines of text.

Use the guessed value from a prior rendering for the new one,
reducing any reflow that has to occur upon viewing another
file in the same application session.

Chrome on Linux is showing the lines are 15px tall, so use
that as the current default guess, reducing initial reflow
for any platform that has this font height.

Bug: issue 2970
Change-Id: Ic5f7dbbd1cc3582388cfcdf6faf9dca1f7a85fa0
Fix compilation failure in acceptance tests

In commit 55d8727967cf53c70d206a68d80d1cece35b1efa the footer keys
were moved into a common class, but one of the acceptance tests was
still referring to the old class.

Also remove some now unused imports.

Change-Id: Ie54da5b4de630dc26c85a36a3ec21a3935c20612
Merge "Replace parboiled with custom built version"
Merge "SideBySide2: Fix alignment for long insertion/deletion blocks"
Factor out DiffInfo classes to extensions package

Change-Id: Ia447d9a6bfe09c7e7b41216141b806d300d27fd4
Merge "Factor out DiffInfo classes to extensions package"