Merge "Add debug logs for mergeability check"
diff --git a/java/com/google/gerrit/server/change/MergeabilityCacheImpl.java b/java/com/google/gerrit/server/change/MergeabilityCacheImpl.java
index 44af1e4..7097eb8 100644
--- a/java/com/google/gerrit/server/change/MergeabilityCacheImpl.java
+++ b/java/com/google/gerrit/server/change/MergeabilityCacheImpl.java
@@ -221,6 +221,9 @@
@Override
public Boolean getIfPresent(
ObjectId commit, Ref intoRef, SubmitType submitType, String mergeStrategy) {
- return cache.getIfPresent(new EntryKey(commit, toId(intoRef), submitType, mergeStrategy));
+ EntryKey entryKey = new EntryKey(commit, toId(intoRef), submitType, mergeStrategy);
+ Boolean mergeable = cache.getIfPresent(entryKey);
+ logger.atFine().log("got mergeable=%s (entryKey=%s)", mergeable, entryKey);
+ return mergeable;
}
}
diff --git a/java/com/google/gerrit/server/git/MergeUtil.java b/java/com/google/gerrit/server/git/MergeUtil.java
index 86893c1..beb6097 100644
--- a/java/com/google/gerrit/server/git/MergeUtil.java
+++ b/java/com/google/gerrit/server/git/MergeUtil.java
@@ -785,6 +785,7 @@
CodeReviewCommit mergeTip,
CodeReviewCommit toMerge) {
if (hasMissingDependencies(mergeSorter, toMerge)) {
+ logger.atFine().log("%s cannot be merged due to missing dependencies", toMerge.name());
return false;
}
@@ -795,9 +796,11 @@
try (ObjectInserter ins = new InMemoryInserter(repo)) {
return newThreeWayMerger(ins, repo.getConfig()).merge(mergeTip, toMerge);
} catch (LargeObjectException e) {
- logger.atWarning().log("Cannot merge due to LargeObjectException: %s", toMerge.name());
+ logger.atWarning().log("%s cannot be merged due to LargeObjectException", toMerge.name());
return false;
} catch (NoMergeBaseException e) {
+ logger.atFine().log(
+ "%s cannot be merged because no merge base could be found", toMerge.name());
return false;
} catch (IOException e) {
throw new StorageException("Cannot merge " + toMerge.name(), e);