Skip to content

Instantly share code, notes, and snippets.

@kristofmeixner
Created July 12, 2016 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristofmeixner/8703ea098bcec52a2233537aaecc9f20 to your computer and use it in GitHub Desktop.
Save kristofmeixner/8703ea098bcec52a2233537aaecc9f20 to your computer and use it in GitHub Desktop.
Retrieving the dataset commit and re-executing the query
String workingTreeDir = getWorkingTreeDir();
Git git = new Git(repository));
// Checking out the query branch and loading the query
git.checkout().setName("refs/heads/queries").call();
Path path = Paths.get(workingTreeDir, DigestUtils.sha1Hex(pid) + ".query");
Properties properties = properties.load(Files.newBufferedReader(path))
// Extracting the commit hash from the metadata file
Query query = new DefaultQuery(properties.getProperty("commit"));
String revision = query.getCommit().getRevisionId();
// Retrieving the correct commit that contains the dataset
git.checkout().setName(revision).call();
ObjectId head = repository.resolve(Constants.HEAD);
// Re-executing the query on the dataset
TableModel tableModel = retrieveDatasetForQuery(workingTreeDir, query.getQuery(), head);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment