Move ChangeNoteUtil#changeRefName to RefNames

Draft-related refnames are already there.

Use static imports consistently so at the end of the day it doesn't
matter where this is.

Change-Id: Id22df41d9189d59bbe9ed1f8ca5797dbd92a9626
This commit is contained in:
Dave Borowitz
2016-05-02 15:45:22 -04:00
parent 2c6ee5a290
commit 52fe68213f
11 changed files with 36 additions and 38 deletions

View File

@@ -15,8 +15,8 @@
package com.google.gerrit.server.notedb;
import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.reviewdb.client.RefNames.changeMetaRef;
import static com.google.gerrit.reviewdb.client.RefNames.refsDraftComments;
import static com.google.gerrit.server.notedb.ChangeNoteUtil.changeRefName;
import static com.google.gerrit.server.notedb.ReviewerStateInternal.CC;
import static com.google.gerrit.server.notedb.ReviewerStateInternal.REVIEWER;
import static com.google.gerrit.testutil.TestChanges.incrementPatchSet;
@@ -525,7 +525,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
@Test
public void emptyChangeUpdate() throws Exception {
Change c = newChange();
Ref initial = repo.exactRef(changeRefName(c.getId()));
Ref initial = repo.exactRef(changeMetaRef(c.getId()));
assertThat(initial).isNotNull();
// Empty update doesn't create a new commit.
@@ -533,7 +533,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.commit();
assertThat(update.getResult()).isNull();
Ref updated = repo.exactRef(changeRefName(c.getId()));
Ref updated = repo.exactRef(changeMetaRef(c.getId()));
assertThat(updated.getObjectId()).isEqualTo(initial.getObjectId());
}
@@ -1877,7 +1877,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.putComment(comment);
update.commit();
assertThat(repo.exactRef(changeRefName(c.getId()))).isNotNull();
assertThat(repo.exactRef(changeMetaRef(c.getId()))).isNotNull();
String draftRef = refsDraftComments(otherUser.getAccountId(), c.getId());
assertThat(exactRefAllUsers(draftRef)).isNull();
}

View File

@@ -20,12 +20,12 @@ import com.google.common.base.Joiner;
import com.google.common.collect.Iterables;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.reviewdb.server.ReviewDbUtil;
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.ChangeNoteUtil;
import com.google.gerrit.server.notedb.ChangeNotes;
import com.google.gerrit.server.notedb.ChangeRebuilder;
import com.google.gerrit.server.schema.DisabledChangesReviewDbWrapper;
@@ -118,8 +118,7 @@ public class NoteDbChecker {
public void assertNoChangeRef(Project.NameKey project, Change.Id changeId)
throws Exception {
try (Repository repo = repoManager.openRepository(project)) {
assertThat(repo.exactRef(ChangeNoteUtil.changeRefName(changeId)))
.isNull();
assertThat(repo.exactRef(RefNames.changeMetaRef(changeId))).isNull();
}
}