Move ChangeRebuilder(Impl) to a subpackage
Change-Id: Ifba1d4577725d595f384eec31d5c8f9b3a217921
This commit is contained in:
@@ -20,8 +20,8 @@ import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.change.Rebuild.Input;
|
||||
import com.google.gerrit.server.notedb.ChangeRebuilder;
|
||||
import com.google.gerrit.server.notedb.NotesMigration;
|
||||
import com.google.gerrit.server.notedb.rebuild.ChangeRebuilder;
|
||||
import com.google.gerrit.server.project.NoSuchChangeException;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.config.AllUsersName;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.notedb.ChangeNotesCommit.ChangeNotesRevWalk;
|
||||
import com.google.gerrit.server.notedb.rebuild.ChangeRebuilder;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
|
||||
@@ -53,6 +53,7 @@ import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.PatchLineCommentsUtil;
|
||||
import com.google.gerrit.server.ReviewerSet;
|
||||
import com.google.gerrit.server.notedb.rebuild.ChangeRebuilderImpl;
|
||||
import com.google.gwtorm.client.Column;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
|
||||
|
||||
@@ -61,20 +61,21 @@ import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
public class ChangeNoteUtil {
|
||||
static final FooterKey FOOTER_BRANCH = new FooterKey("Branch");
|
||||
static final FooterKey FOOTER_CHANGE_ID = new FooterKey("Change-id");
|
||||
static final FooterKey FOOTER_COMMIT = new FooterKey("Commit");
|
||||
static final FooterKey FOOTER_GROUPS = new FooterKey("Groups");
|
||||
static final FooterKey FOOTER_HASHTAGS = new FooterKey("Hashtags");
|
||||
static final FooterKey FOOTER_LABEL = new FooterKey("Label");
|
||||
static final FooterKey FOOTER_PATCH_SET = new FooterKey("Patch-set");
|
||||
static final FooterKey FOOTER_STATUS = new FooterKey("Status");
|
||||
static final FooterKey FOOTER_SUBJECT = new FooterKey("Subject");
|
||||
static final FooterKey FOOTER_SUBMISSION_ID = new FooterKey("Submission-id");
|
||||
static final FooterKey FOOTER_SUBMITTED_WITH =
|
||||
public static final FooterKey FOOTER_BRANCH = new FooterKey("Branch");
|
||||
public static final FooterKey FOOTER_CHANGE_ID = new FooterKey("Change-id");
|
||||
public static final FooterKey FOOTER_COMMIT = new FooterKey("Commit");
|
||||
public static final FooterKey FOOTER_GROUPS = new FooterKey("Groups");
|
||||
public static final FooterKey FOOTER_HASHTAGS = new FooterKey("Hashtags");
|
||||
public static final FooterKey FOOTER_LABEL = new FooterKey("Label");
|
||||
public static final FooterKey FOOTER_PATCH_SET = new FooterKey("Patch-set");
|
||||
public static final FooterKey FOOTER_STATUS = new FooterKey("Status");
|
||||
public static final FooterKey FOOTER_SUBJECT = new FooterKey("Subject");
|
||||
public static final FooterKey FOOTER_SUBMISSION_ID =
|
||||
new FooterKey("Submission-id");
|
||||
public static final FooterKey FOOTER_SUBMITTED_WITH =
|
||||
new FooterKey("Submitted-with");
|
||||
static final FooterKey FOOTER_TOPIC = new FooterKey("Topic");
|
||||
static final FooterKey FOOTER_TAG = new FooterKey("Tag");
|
||||
public static final FooterKey FOOTER_TOPIC = new FooterKey("Topic");
|
||||
public static final FooterKey FOOTER_TAG = new FooterKey("Tag");
|
||||
|
||||
private static final String AUTHOR = "Author";
|
||||
private static final String BASE_PATCH_SET = "Base-for-patch-set";
|
||||
|
||||
@@ -52,6 +52,7 @@ import com.google.gerrit.server.ReviewerSet;
|
||||
import com.google.gerrit.server.ReviewerStatusUpdate;
|
||||
import com.google.gerrit.server.git.RefCache;
|
||||
import com.google.gerrit.server.git.RepoRefCache;
|
||||
import com.google.gerrit.server.notedb.rebuild.ChangeRebuilder;
|
||||
import com.google.gerrit.server.project.NoSuchChangeException;
|
||||
import com.google.gerrit.server.project.ProjectCache;
|
||||
import com.google.gerrit.server.query.change.ChangeData;
|
||||
|
||||
@@ -284,7 +284,7 @@ public class ChangeUpdate extends AbstractChangeUpdate {
|
||||
this.commitSubject = commitSubject;
|
||||
}
|
||||
|
||||
void setSubject(String subject) {
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.google.gerrit.reviewdb.client.RevId;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.git.RepoRefCache;
|
||||
import com.google.gerrit.server.notedb.NoteDbUpdateManager.StagedResult;
|
||||
import com.google.gerrit.server.notedb.rebuild.ChangeRebuilder;
|
||||
import com.google.gerrit.server.project.NoSuchChangeException;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class NoteDbChangeState {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
static NoteDbChangeState parse(Change.Id id, String str) {
|
||||
public static NoteDbChangeState parse(Change.Id id, String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -204,7 +204,7 @@ public class NoteDbChangeState {
|
||||
return id.get().equals(draftIds.get(accountId));
|
||||
}
|
||||
|
||||
boolean isUpToDate(RefCache changeRepoRefs, RefCache draftsRepoRefs)
|
||||
public boolean isUpToDate(RefCache changeRepoRefs, RefCache draftsRepoRefs)
|
||||
throws IOException {
|
||||
if (!isChangeUpToDate(changeRepoRefs)) {
|
||||
return false;
|
||||
|
||||
@@ -23,6 +23,8 @@ import com.google.gerrit.reviewdb.client.Change.Id;
|
||||
import com.google.gerrit.reviewdb.client.Project.NameKey;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.notedb.NoteDbUpdateManager.Result;
|
||||
import com.google.gerrit.server.notedb.rebuild.ChangeRebuilder;
|
||||
import com.google.gerrit.server.notedb.rebuild.ChangeRebuilderImpl;
|
||||
import com.google.inject.TypeLiteral;
|
||||
import com.google.inject.name.Names;
|
||||
|
||||
|
||||
@@ -119,10 +119,10 @@ public class NoteDbUpdateManager implements AutoCloseable {
|
||||
@Nullable abstract NoteDbUpdateManager.StagedResult staged();
|
||||
}
|
||||
|
||||
static class OpenRepo implements AutoCloseable {
|
||||
final Repository repo;
|
||||
final RevWalk rw;
|
||||
final ChainedReceiveCommands cmds;
|
||||
public static class OpenRepo implements AutoCloseable {
|
||||
public final Repository repo;
|
||||
public final RevWalk rw;
|
||||
public final ChainedReceiveCommands cmds;
|
||||
|
||||
private final InMemoryInserter tempIns;
|
||||
@Nullable private final ObjectInserter finalIns;
|
||||
@@ -143,7 +143,7 @@ public class NoteDbUpdateManager implements AutoCloseable {
|
||||
this.close = close;
|
||||
}
|
||||
|
||||
Optional<ObjectId> getObjectId(String refName) throws IOException {
|
||||
public Optional<ObjectId> getObjectId(String refName) throws IOException {
|
||||
return cmds.get(refName);
|
||||
}
|
||||
|
||||
@@ -233,17 +233,17 @@ public class NoteDbUpdateManager implements AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
|
||||
NoteDbUpdateManager setCheckExpectedState(boolean checkExpectedState) {
|
||||
public NoteDbUpdateManager setCheckExpectedState(boolean checkExpectedState) {
|
||||
this.checkExpectedState = checkExpectedState;
|
||||
return this;
|
||||
}
|
||||
|
||||
OpenRepo getChangeRepo() throws IOException {
|
||||
public OpenRepo getChangeRepo() throws IOException {
|
||||
initChangeRepo();
|
||||
return changeRepo;
|
||||
}
|
||||
|
||||
OpenRepo getAllUsersRepo() throws IOException {
|
||||
public OpenRepo getAllUsersRepo() throws IOException {
|
||||
initAllUsersRepo();
|
||||
return allUsersRepo;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.notedb.NoteDbUpdateManager.Result;
|
||||
import com.google.gerrit.server.notedb.rebuild.ChangeRebuilder;
|
||||
import com.google.gerrit.server.notedb.rebuild.ChangeRebuilderImpl;
|
||||
import com.google.gerrit.server.project.NoSuchChangeException;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.gwtorm.server.SchemaFactory;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.notedb;
|
||||
package com.google.gerrit.server.notedb.rebuild;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
@@ -20,6 +20,8 @@ import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.notedb.ChangeBundle;
|
||||
import com.google.gerrit.server.notedb.NoteDbUpdateManager;
|
||||
import com.google.gerrit.server.notedb.NoteDbUpdateManager.Result;
|
||||
import com.google.gerrit.server.project.NoSuchChangeException;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.notedb;
|
||||
package com.google.gerrit.server.notedb.rebuild;
|
||||
|
||||
import static com.google.common.base.MoreObjects.firstNonNull;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
@@ -56,8 +56,18 @@ import com.google.gerrit.server.PatchLineCommentsUtil;
|
||||
import com.google.gerrit.server.account.AccountCache;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.server.git.ChainedReceiveCommands;
|
||||
import com.google.gerrit.server.notedb.AbstractChangeUpdate;
|
||||
import com.google.gerrit.server.notedb.ChangeBundle;
|
||||
import com.google.gerrit.server.notedb.ChangeDraftUpdate;
|
||||
import com.google.gerrit.server.notedb.ChangeNoteUtil;
|
||||
import com.google.gerrit.server.notedb.ChangeUpdate;
|
||||
import com.google.gerrit.server.notedb.NoteDbChangeState;
|
||||
import com.google.gerrit.server.notedb.NoteDbUpdateManager;
|
||||
import com.google.gerrit.server.notedb.NoteDbUpdateManager.OpenRepo;
|
||||
import com.google.gerrit.server.notedb.NoteDbUpdateManager.Result;
|
||||
import com.google.gerrit.server.notedb.NotesMigration;
|
||||
import com.google.gerrit.server.notedb.PatchSetState;
|
||||
import com.google.gerrit.server.notedb.ReviewerStateInternal;
|
||||
import com.google.gerrit.server.patch.PatchListCache;
|
||||
import com.google.gerrit.server.project.NoSuchChangeException;
|
||||
import com.google.gerrit.server.project.ProjectCache;
|
||||
@@ -108,7 +118,7 @@ public class ChangeRebuilderImpl extends ChangeRebuilder {
|
||||
* historically didn't necessarily use the same timestamp, and tended to call
|
||||
* {@code System.currentTimeMillis()} independently.
|
||||
*/
|
||||
static final long MAX_WINDOW_MS = SECONDS.toMillis(3);
|
||||
public static final long MAX_WINDOW_MS = SECONDS.toMillis(3);
|
||||
|
||||
/**
|
||||
* The maximum amount of time between two consecutive events to consider them
|
||||
@@ -39,6 +39,7 @@ import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.client.RevId;
|
||||
import com.google.gerrit.server.ReviewerSet;
|
||||
import com.google.gerrit.server.notedb.rebuild.ChangeRebuilderImpl;
|
||||
import com.google.gerrit.testutil.TestChanges;
|
||||
import com.google.gerrit.testutil.TestTimeUtil;
|
||||
import com.google.gwtorm.client.KeyUtil;
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.google.gerrit.server.PatchLineCommentsUtil;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.notedb.ChangeBundle;
|
||||
import com.google.gerrit.server.notedb.ChangeNotes;
|
||||
import com.google.gerrit.server.notedb.ChangeRebuilder;
|
||||
import com.google.gerrit.server.notedb.rebuild.ChangeRebuilder;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
Reference in New Issue
Block a user