Merge "Make refs/draft-comments/ consistent with refs/starred-changes/"
This commit is contained in:
@@ -92,28 +92,13 @@ public class RefNames {
|
|||||||
|
|
||||||
public static String refsDraftComments(Account.Id accountId,
|
public static String refsDraftComments(Account.Id accountId,
|
||||||
Change.Id changeId) {
|
Change.Id changeId) {
|
||||||
StringBuilder r = buildRefsDraftCommentsPrefix(accountId);
|
StringBuilder r = buildRefsPrefix(REFS_DRAFT_COMMENTS, accountId);
|
||||||
r.append(changeId.get());
|
r.append(changeId.get());
|
||||||
return r.toString();
|
return r.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String refsDraftCommentsPrefix(Account.Id accountId) {
|
public static String refsDraftCommentsPrefix(Account.Id accountId) {
|
||||||
return buildRefsDraftCommentsPrefix(accountId).toString();
|
return buildRefsPrefix(REFS_DRAFT_COMMENTS, accountId).toString();
|
||||||
}
|
|
||||||
|
|
||||||
public static StringBuilder buildRefsDraftCommentsPrefix(
|
|
||||||
Account.Id accountId) {
|
|
||||||
StringBuilder r = new StringBuilder();
|
|
||||||
r.append(REFS_DRAFT_COMMENTS);
|
|
||||||
int n = accountId.get() % 100;
|
|
||||||
if (n < 10) {
|
|
||||||
r.append('0');
|
|
||||||
}
|
|
||||||
r.append(n);
|
|
||||||
r.append('/');
|
|
||||||
r.append(accountId.get());
|
|
||||||
r.append('-');
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String refsStarredChanges(Account.Id accountId,
|
public static String refsStarredChanges(Account.Id accountId,
|
||||||
|
@@ -39,13 +39,13 @@ public class RefNamesTest {
|
|||||||
@Test
|
@Test
|
||||||
public void refsDraftComments() throws Exception {
|
public void refsDraftComments() throws Exception {
|
||||||
assertThat(RefNames.refsDraftComments(accountId, changeId))
|
assertThat(RefNames.refsDraftComments(accountId, changeId))
|
||||||
.isEqualTo("refs/draft-comments/23/1011123-67473");
|
.isEqualTo("refs/draft-comments/23/1011123/67473");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void refsDraftCommentsPrefix() throws Exception {
|
public void refsDraftCommentsPrefix() throws Exception {
|
||||||
assertThat(RefNames.refsDraftCommentsPrefix(accountId))
|
assertThat(RefNames.refsDraftCommentsPrefix(accountId))
|
||||||
.isEqualTo("refs/draft-comments/23/1011123-");
|
.isEqualTo("refs/draft-comments/23/1011123/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -371,7 +371,7 @@ public class PatchLineCommentsUtil {
|
|||||||
private Iterable<String> getDraftRefs(final Change.Id changeId)
|
private Iterable<String> getDraftRefs(final Change.Id changeId)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
Set<String> refNames = getRefNamesAllUsers(RefNames.REFS_DRAFT_COMMENTS);
|
Set<String> refNames = getRefNamesAllUsers(RefNames.REFS_DRAFT_COMMENTS);
|
||||||
final String suffix = "-" + changeId.get();
|
final String suffix = "/" + changeId.get();
|
||||||
return Iterables.filter(refNames, new Predicate<String>() {
|
return Iterables.filter(refNames, new Predicate<String>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(String input) {
|
public boolean apply(String input) {
|
||||||
|
Reference in New Issue
Block a user