OAK-2308: Incorrect recovery of _lastRev for branch commit

Test and fix

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1642648 13f79535-47bb-0310-9956-ffa450edef68
OAK-1941 - remove unused code

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1642665 13f79535-47bb-0310-9956-ffa450edef68
OAK-2294: Corrupt repository after concurrent version operations
Throw custom exception instead of ISE when segment references are exceeded

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1642667 13f79535-47bb-0310-9956-ffa450edef68