From f0945d9a54b19da3a544fd9f1c2f7796afe90812 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 28 Jan 2021 19:28:42 -0500 Subject: [PATCH] BF: orchestrators: Update for change in 'datalad subdatasets' key In DataLad v0.12.0 (c89746c27e), the "revision" key in the results for `datalad subdatasets` was changed from "revision" to "gitshasum", and the old name was kept around for compatibility. The old key will be removed in the upcoming 0.14 release (f5c3104d88). Look for "gitshasum", but fall back to "revision" because the DataLad version on the remote may be below the version specified in setup.py (currently 0.13). Fixes #568. --- reproman/support/jobs/orchestrators.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/reproman/support/jobs/orchestrators.py b/reproman/support/jobs/orchestrators.py index 58a033cd4..3fa021ee1 100644 --- a/reproman/support/jobs/orchestrators.py +++ b/reproman/support/jobs/orchestrators.py @@ -751,7 +751,14 @@ def _fix_up_dataset(self): cwd = res["path"] self._assert_clean_repo(cwd=cwd) lgr.debug("Adjusting state of %s", cwd) - cmds = [["git", "checkout", res["revision"]], + # "gitshasum" replaced "revision" in v0.12, with the old name kept + # for compatibility until v0.14. Even though the minimum version + # for DataLad in setup.py is above 0.12, support both keys until + # the minimum version for the _remote_ is specified/checked (see + # gh-477). + revision = res.get("gitshasum", res.get("revision")) + assert revision, "bug: incorrectly assumed revision is in results" + cmds = [["git", "checkout", revision], ["git", "annex", "init"]] for cmd in cmds: try: