Merge branch 'stable-2.12'
* stable-2.12: PatchSetInserter: Always use db from Context RefNames#fullName: Don't prepend "refs/heads/" for HEAD Mergeability: handle UncheckedExecutionException like ExecutionException Change-Id: I8a5e136e0b13d66871358aae7b56033ea64a03f2
This commit is contained in:
@@ -16,6 +16,8 @@ package com.google.gerrit.reviewdb.client;
|
||||
|
||||
/** Constants and utilities for Gerrit-specific ref names. */
|
||||
public class RefNames {
|
||||
public static final String HEAD = "HEAD";
|
||||
|
||||
public static final String REFS = "refs/";
|
||||
|
||||
public static final String REFS_HEADS = "refs/heads/";
|
||||
@@ -69,7 +71,8 @@ public class RefNames {
|
||||
public static final String EDIT_PREFIX = "edit-";
|
||||
|
||||
public static String fullName(String ref) {
|
||||
return ref.startsWith(REFS) ? ref : REFS_HEADS + ref;
|
||||
return (ref.startsWith(REFS) || ref.equals(HEAD)) ?
|
||||
ref : REFS_HEADS + ref;
|
||||
}
|
||||
|
||||
public static final String shortName(String ref) {
|
||||
|
||||
@@ -31,6 +31,7 @@ public class RefNamesTest {
|
||||
assertThat(RefNames.fullName("refs/heads/master")).isEqualTo("refs/heads/master");
|
||||
assertThat(RefNames.fullName("master")).isEqualTo("refs/heads/master");
|
||||
assertThat(RefNames.fullName("refs/tags/v1.0")).isEqualTo("refs/tags/v1.0");
|
||||
assertThat(RefNames.fullName("HEAD")).isEqualTo("HEAD");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.Weigher;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.ImmutableBiMap;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import com.google.gerrit.extensions.client.SubmitType;
|
||||
import com.google.gerrit.reviewdb.client.Branch;
|
||||
import com.google.gerrit.server.cache.CacheModule;
|
||||
@@ -229,7 +230,7 @@ public class MergeabilityCacheImpl implements MergeabilityCache {
|
||||
EntryKey key = new EntryKey(commit, into, submitType, mergeStrategy);
|
||||
try {
|
||||
return cache.get(key, new Loader(key, dest, repo));
|
||||
} catch (ExecutionException e) {
|
||||
} catch (ExecutionException | UncheckedExecutionException e) {
|
||||
log.error(String.format("Error checking mergeability of %s into %s (%s)",
|
||||
key.commit.name(), key.into.name(), key.submitType.name()),
|
||||
e.getCause());
|
||||
|
||||
Reference in New Issue
Block a user