Move users of Branch constants to RefNames constants.

This seems like a better place for these constants.

Change-Id: I18aa13c45902c64236ccdb239a038fe0760af0ec
This commit is contained in:
Martin Fick 2015-04-13 13:51:54 -06:00
parent 9d8b1361ca
commit e3f38e3cd3
3 changed files with 6 additions and 9 deletions

View File

@ -17,9 +17,9 @@ package com.google.gerrit.client.ui;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.changes.QueryScreen;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.RefNames;
/** Link to the open changes of a project. */
public class BranchLink extends InlineHyperlink {
@ -61,10 +61,10 @@ public class BranchLink extends InlineHyperlink {
String branch, String topic) {
String query = PageLinks.projectQuery(project, status);
if (branch.startsWith(Branch.R_REFS)) {
if (branch.startsWith(Branch.R_HEADS)) {
if (branch.startsWith(RefNames.REFS)) {
if (branch.startsWith(RefNames.REFS_HEADS)) {
query += " " + PageLinks.op("branch", //
branch.substring(Branch.R_HEADS.length()));
branch.substring(RefNames.REFS_HEADS.length()));
} else {
query += " " + PageLinks.op("ref", branch);
}

View File

@ -19,9 +19,6 @@ import com.google.gwtorm.client.StringKey;
/** Line of development within a {@link Project}. */
public final class Branch {
public static final String R_HEADS = "refs/heads/";
public static final String R_REFS = "refs/";
/** Branch name key */
public static class NameKey extends StringKey<Project.NameKey> {
private static final long serialVersionUID = 1L;

View File

@ -20,7 +20,7 @@ import static org.eclipse.jgit.lib.RefDatabase.ALL;
import com.google.gerrit.common.data.GlobalCapability;
import com.google.gerrit.extensions.annotations.RequiresCapability;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.AccountResolver;
@ -110,7 +110,7 @@ public class LsUserRefs extends SshCommand {
db, true).filter(repo.getRefDatabase().getRefs(ALL), false);
for (final String ref : refsMap.keySet()) {
if (!onlyRefsHeads || ref.startsWith(Branch.R_HEADS)) {
if (!onlyRefsHeads || ref.startsWith(RefNames.REFS_HEADS)) {
stdout.println(ref);
}
}