/** * Query whether this version of LensKit includes a particular revision. * * @param revision The revision to query. * @return {@code true} if the LensKit source is descended from {@code revision}. */ public static boolean includesRevision(String revision) { return getRevisions().contains(revision); }
/** * Get the set of revisions LensKit is built from. This is in the order returned by {@code git log}, * so the head revision is first. * @return The set of revisions included in this build of LensKit. */ @Nonnull public static synchronized Set<String> getRevisions() { Set<String> revisions = revisionSet == null ? null : revisionSet.get(); if (revisions == null) { revisions = loadRevisionSet(); revisionSet = new SoftReference<>(revisions); } return revisions; }
@Override public void execute(Namespace opts) { String version = LenskitInfo.lenskitVersion(); System.out.format("LensKit version %s%n", version); if (version.endsWith("-SNAPSHOT")) { System.out.format("Git revision %s%n", LenskitInfo.getHeadRevision()); } }
@Test public void testIncludesRevision() throws Exception { assertThat(LenskitInfo.includesRevision("9103068a95fc650f9f4670683308819366e9d03b"), equalTo(true)); } }
/** * Get the HEAD revision from which LensKit was built. * @return The revision from which this version of LensKit was built. */ @Nonnull public static String getHeadRevision() { Iterator<String> iter = getRevisions().iterator(); if (iter.hasNext()) { return iter.next(); } else { return "UNKNOWN"; } }
Runtime rt = Runtime.getRuntime(); logger.info("Starting LensKit {} on Java {} from {}", LenskitInfo.lenskitVersion(), SystemUtils.JAVA_VERSION, SystemUtils.JAVA_VENDOR); logger.debug("Built from Git revision {}", LenskitInfo.getHeadRevision()); logger.debug("Using VM '{}' version {} from {}", SystemUtils.JAVA_VM_NAME,
/** * Get the set of revisions LensKit is built from. This is in the order returned by {@code git log}, * so the head revision is first. * @return The set of revisions included in this build of LensKit. */ @Nonnull public static synchronized Set<String> getRevisions() { Set<String> revisions = revisionSet == null ? null : revisionSet.get(); if (revisions == null) { revisions = loadRevisionSet(); revisionSet = new SoftReference<>(revisions); } return revisions; }
@Test public void testGetRevisions() throws Exception { assertThat(LenskitInfo.getRevisions(), hasItem("9103068a95fc650f9f4670683308819366e9d03b")); }
/** * Query whether this version of LensKit includes a particular revision. * * @param revision The revision to query. * @return {@code true} if the LensKit source is descended from {@code revision}. */ public static boolean includesRevision(String revision) { return getRevisions().contains(revision); }
/** * Get the HEAD revision from which LensKit was built. * @return The revision from which this version of LensKit was built. */ @Nonnull public static String getHeadRevision() { Iterator<String> iter = getRevisions().iterator(); if (iter.hasNext()) { return iter.next(); } else { return "UNKNOWN"; } }