diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 0b42152..bbfde2b 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -114,21 +114,42 @@ def getgitlogdifferences(String gitrootfolder, String earlyrevision, String late return differencetext } +def extractsha(String line) { + def pattern = ~"^(.*)\s(.*)" + + def sha = line.replaceFirst(pattern) { _, sha, therest -> "${sha.trim()}" } + def therest = line.replaceFirst(pattern) { _, sha, therest -> "${therest.trim()}" } + + echo "Sha filtering: line: ${line} sha: ${sha} therest: ${therest}" + + return [sha, therest] +} + +def DifferenceRecord fillrecord(meta, line) { + def DifferenceRecord dr = new DifferenceRecord() + + dr.productname = meta.productinfo.productname + dr.subcomponentname = meta.productinfo.subcomponentname + dr.jirakey = meta.productinfo.jirakey + + dr.rawdifferencetext = line + + // Example of raw text to process: + // 76056562e4 GIS-1621 - Removing redundant lines and effects of this - Restore nuget_version_edit.py + + (dr.sha, line) = extractsha(line) + + dr.type = 0 + dr.jiraticketinfo = "info" + + return dr +} + def List processtext(meta, String text) { def List differencerecords = [] - - text.split('\n').each { - def DifferenceRecord dr = new DifferenceRecord() - - dr.productname = meta.productinfo.productname - dr.subcomponentname = meta.productinfo.subcomponentname - dr.jirakey = meta.productinfo.jirakey - dr.rawdifferencetext = it.trim() - dr.sha = "sha" - dr.type = 0 - dr.jiraticketinfo = "info" - + text.split('\n').each { + DifferenceRecord dr = fillrecord(meta, it.trim()) differencerecords.add(dr) } return differencerecords