Add more difference infrastructure

This commit is contained in:
Dan Hawkins 2019-07-04 11:03:16 +01:00
commit d1d69c6c63

View file

@ -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