Remove superfluous/misleading methods from ChangeEdit

Some of the methods of ChangeEdit were superfluous or misleading.
For this reason, code calling one of those methods is adjusted to work
without them.

Change-Id: I7a2e094bb6eaf5a5ae98e24f03cd615a3c7d0fff
This commit is contained in:
Alice Kober-Sotzek
2017-03-16 15:07:27 +01:00
parent 30d6c7d3da
commit a28db80825
11 changed files with 36 additions and 70 deletions

View File

@@ -18,11 +18,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.reviewdb.client.RevId;
import com.google.gerrit.server.IdentifiedUser;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.revwalk.RevCommit;
/**
@@ -33,44 +28,25 @@ import org.eclipse.jgit.revwalk.RevCommit;
* change number and P is the patch set number it is based on.
*/
public class ChangeEdit {
private final IdentifiedUser user;
private final Change change;
private final Ref ref;
private final String editRefName;
private final RevCommit editCommit;
private final PatchSet basePatchSet;
public ChangeEdit(
IdentifiedUser user, Change change, Ref ref, RevCommit editCommit, PatchSet basePatchSet) {
checkNotNull(user);
checkNotNull(change);
checkNotNull(ref);
checkNotNull(editCommit);
checkNotNull(basePatchSet);
this.user = user;
this.change = change;
this.ref = ref;
this.editCommit = editCommit;
this.basePatchSet = basePatchSet;
Change change, String editRefName, RevCommit editCommit, PatchSet basePatchSet) {
this.change = checkNotNull(change);
this.editRefName = checkNotNull(editRefName);
this.editCommit = checkNotNull(editCommit);
this.basePatchSet = checkNotNull(basePatchSet);
}
public Change getChange() {
return change;
}
public IdentifiedUser getUser() {
return user;
}
public Ref getRef() {
return ref;
}
public RevId getRevision() {
return new RevId(ObjectId.toString(ref.getObjectId()));
}
public String getRefName() {
return RefNames.refsEdit(user.getAccountId(), change.getId(), basePatchSet.getId());
return editRefName;
}
public RevCommit getEditCommit() {