From a32fbee67b59dba3c928b67fe2aa80b1b838b101 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 23 May 2019 23:25:53 +0100 Subject: [PATCH] MCS-425 - Perform a sparse checkout of items to import from a release repo --- import/importer.groovy | 2 +- publish/do.groovy | 13 ------------- versioncontrol/git.groovy | 13 +++++++++++++ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index d85818f..764618c 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -81,7 +81,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def rootrevision = revision.trim() echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - def ArrayList sparseitemlist = gh.convertstringitemstopublish(filter) + def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) def importedmeta = meta.importrelated(destpath) diff --git a/publish/do.groovy b/publish/do.groovy index 6207380..1599ca8 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -148,19 +148,6 @@ def convertitemstopublish(String itemstopublishstring) { return paths } -def convertstringitemstopublish(String itemstopublishstring) { - def List paths = [] - - def String[] items = itemstopublishstring.split(',') - def String allpaths = "" - for(String item : items) { - paths.add(item) - allpaths += "${path}\n" - } - echo "Selected item to publish:\n${allpaths}" - return paths -} - // Publish selected items from a release to the customer folder on the ftp site // itemstopublishstring is a comma-seperated set of strings in this format ## def publishhierarchy(releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 534084d..818734a 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -246,6 +246,19 @@ def gitsparserestore(String targetDir) { } } +def List convertSparseItemsString(String itemstopublish) { + def List paths = [] + + def String[] items = itemstopublish.split(',') + def String allpaths = "" + for(String item : items) { + paths.add(item) + allpaths += "${path}\n" + } + echo "Selected item to publish:\n${allpaths}" + return paths +} + def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { echo "Performing alternative checkout" def String reporootpath = lfsinstallandreporoot(gitURL)