Remove PatchSetAncestors table
The only remaining callers are the insert and delete code paths; it is no longer used for lookups. Change-Id: Id665eda39b585750f1b4032312ea04f5539456b4
This commit is contained in:
		@@ -39,8 +39,6 @@ import java.util.Arrays;
 | 
			
		||||
 *          |
 | 
			
		||||
 *          +- {@link PatchSetApproval}: a +/- vote on the change's current state.
 | 
			
		||||
 *          |
 | 
			
		||||
 *          +- {@link PatchSetAncestor}: parents of this change's commit.
 | 
			
		||||
 *          |
 | 
			
		||||
 *          +- {@link PatchLineComment}: comment about a specific line
 | 
			
		||||
 * </pre>
 | 
			
		||||
 * <p>
 | 
			
		||||
@@ -51,11 +49,6 @@ import java.util.Arrays;
 | 
			
		||||
 * {@link Account} is usually also listed as the author and committer in the
 | 
			
		||||
 * PatchSetInfo.
 | 
			
		||||
 * <p>
 | 
			
		||||
 * The {@link PatchSetAncestor} entities are a mirror of the Git commit
 | 
			
		||||
 * metadata, providing access to the information without needing direct
 | 
			
		||||
 * accessing Git. These entities are actually legacy artifacts from Gerrit 1.x
 | 
			
		||||
 * and could be removed, replaced by direct RevCommit access.
 | 
			
		||||
 * <p>
 | 
			
		||||
 * Each PatchSet contains zero or more Patch records, detailing the file paths
 | 
			
		||||
 * impacted by the change (otherwise known as, the file paths the author
 | 
			
		||||
 * added/deleted/modified). Sometimes a merge commit can contain zero patches,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,88 +0,0 @@
 | 
			
		||||
// Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
//
 | 
			
		||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
package com.google.gerrit.reviewdb.client;
 | 
			
		||||
 | 
			
		||||
import com.google.gwtorm.client.Column;
 | 
			
		||||
import com.google.gwtorm.client.IntKey;
 | 
			
		||||
 | 
			
		||||
/** Ancestors of a {@link PatchSet} that the PatchSet depends upon. */
 | 
			
		||||
public final class PatchSetAncestor {
 | 
			
		||||
  public static class Id extends IntKey<PatchSet.Id> {
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    @Column(id = 1, name = Column.NONE)
 | 
			
		||||
    protected PatchSet.Id patchSetId;
 | 
			
		||||
 | 
			
		||||
    @Column(id = 2)
 | 
			
		||||
    protected int position;
 | 
			
		||||
 | 
			
		||||
    protected Id() {
 | 
			
		||||
      patchSetId = new PatchSet.Id();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Id(final PatchSet.Id psId, final int pos) {
 | 
			
		||||
      this.patchSetId = psId;
 | 
			
		||||
      this.position = pos;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public PatchSet.Id getParentKey() {
 | 
			
		||||
      return patchSetId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int get() {
 | 
			
		||||
      return position;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void set(int newValue) {
 | 
			
		||||
      position = newValue;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Column(id = 1, name = Column.NONE)
 | 
			
		||||
  protected Id key;
 | 
			
		||||
 | 
			
		||||
  @Column(id = 2)
 | 
			
		||||
  protected RevId ancestorRevision;
 | 
			
		||||
 | 
			
		||||
  protected PatchSetAncestor() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public PatchSetAncestor(final PatchSetAncestor.Id k) {
 | 
			
		||||
    key = k;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public PatchSetAncestor.Id getId() {
 | 
			
		||||
    return key;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public PatchSet.Id getPatchSet() {
 | 
			
		||||
    return key.patchSetId;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public int getPosition() {
 | 
			
		||||
    return key.position;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public RevId getAncestorRevision() {
 | 
			
		||||
    return ancestorRevision;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public void setAncestorRevision(final RevId id) {
 | 
			
		||||
    ancestorRevision = id;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,45 +0,0 @@
 | 
			
		||||
// Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
//
 | 
			
		||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
package com.google.gerrit.reviewdb.server;
 | 
			
		||||
 | 
			
		||||
import com.google.gerrit.reviewdb.client.Change;
 | 
			
		||||
import com.google.gerrit.reviewdb.client.PatchSet;
 | 
			
		||||
import com.google.gerrit.reviewdb.client.PatchSetAncestor;
 | 
			
		||||
import com.google.gerrit.reviewdb.client.RevId;
 | 
			
		||||
import com.google.gwtorm.server.Access;
 | 
			
		||||
import com.google.gwtorm.server.OrmException;
 | 
			
		||||
import com.google.gwtorm.server.PrimaryKey;
 | 
			
		||||
import com.google.gwtorm.server.Query;
 | 
			
		||||
import com.google.gwtorm.server.ResultSet;
 | 
			
		||||
 | 
			
		||||
public interface PatchSetAncestorAccess extends
 | 
			
		||||
    Access<PatchSetAncestor, PatchSetAncestor.Id> {
 | 
			
		||||
  @Override
 | 
			
		||||
  @PrimaryKey("key")
 | 
			
		||||
  PatchSetAncestor get(PatchSetAncestor.Id key) throws OrmException;
 | 
			
		||||
 | 
			
		||||
  @Query("WHERE key.patchSetId = ? ORDER BY key.position")
 | 
			
		||||
  ResultSet<PatchSetAncestor> ancestorsOf(PatchSet.Id id) throws OrmException;
 | 
			
		||||
 | 
			
		||||
  @Query("WHERE key.patchSetId.changeId = ?")
 | 
			
		||||
  ResultSet<PatchSetAncestor> byChange(Change.Id id) throws OrmException;
 | 
			
		||||
 | 
			
		||||
  @Query("WHERE key.patchSetId = ?")
 | 
			
		||||
  ResultSet<PatchSetAncestor> byPatchSet(PatchSet.Id id) throws OrmException;
 | 
			
		||||
 | 
			
		||||
  @Query("WHERE ancestorRevision = ?")
 | 
			
		||||
  ResultSet<PatchSetAncestor> descendantsOf(RevId revision)
 | 
			
		||||
      throws OrmException;
 | 
			
		||||
}
 | 
			
		||||
@@ -92,8 +92,7 @@ public interface ReviewDb extends Schema {
 | 
			
		||||
  @Relation(id = 24)
 | 
			
		||||
  PatchSetAccess patchSets();
 | 
			
		||||
 | 
			
		||||
  @Relation(id = 25)
 | 
			
		||||
  PatchSetAncestorAccess patchSetAncestors();
 | 
			
		||||
  // Deleted @Relation(id = 25)
 | 
			
		||||
 | 
			
		||||
  @Relation(id = 26)
 | 
			
		||||
  PatchLineCommentAccess patchComments();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user