
The nbrPatchSets counter was used to generate the next PatchSetId. Instead, find the first reference after the currentPatchSetId() that does not exist by examining the references themselves. Also in a few locations, the use of currPatchSetId() was corrected to be currentPatchSetId(). Change-Id: I06bcf52798f1dad1ea602f914784dfcbc7d97086