Read mergeable bit from cache

Change callers on the client side to get this from ChangeInfo
(populated by ChangeJson) rather than Change.

Continue writing to the database, to facilitate online migration.

Change-Id: I7273e0253d357ff80aa3baf2b833419749b958ef
This commit is contained in:
Dave Borowitz
2014-10-09 15:37:58 -07:00
parent db27fb3064
commit 10129d4af2
5 changed files with 53 additions and 41 deletions

View File

@@ -106,6 +106,12 @@ public class MergeabilityCache {
};
}
public static ObjectId toId(Ref ref) {
return ref != null && ref.getObjectId() != null
? ref.getObjectId()
: ObjectId.zeroId();
}
public static class EntryKey implements Serializable {
private static final long serialVersionUID = 1L;
@@ -307,4 +313,10 @@ public class MergeabilityCache {
return false;
}
}
public boolean getIfPresent(ObjectId commit, Ref intoRef,
SubmitType submitType, String mergeStrategy) {
return cache.getIfPresent(new EntryKey(
commit, toId(intoRef), submitType, mergeStrategy, null, null, null));
}
}