Add more difference infrastructure

This commit is contained in:
Dan Hawkins 2019-07-04 14:28:43 +01:00
commit b51c69707a

View file

@ -16,13 +16,15 @@ class DifferenceRecord {
String rawdifferencetext
String sha
int type
String jiraticketinfo
String mergeinfo
List jiraticketinfo
String comment
DifferenceRecord() {
}
def String dump() {
return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\njiraticketinfo: ${jiraticketinfo}"
return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: $(mergeinfo)\njiraticketinfo: ${jiraticketinfo}\ncomment: ${comment}"
}
}
@ -122,11 +124,45 @@ def extractsha(String line) {
def sha = match.group(1)
def restofline = match.group(2)
echo "Sha filtering: line: ${line} sha: ${sha} therest: ${restofline}"
//echo "Sha filtering: line: ${line} sha: ${sha} therest: ${restofline}"
return [sha.trim(), restofline.trim()]
}
def extractmerges(String line) {
def pattern1 = "^(.*)(Merge branch .*)"
def match1 = (line =~ pattern1)
if (match1.find()) {
return [true, match1.group(2)]
}
def pattern2 = "^(.*)(Merge remote-tracking branch .*)"
def match2 = (line =~ pattern2)
if (match2.find()) {
return [true, match2.group(2)]
}
def pattern3 = "^(.*)(Merge commit .*)"
def match3 = (line =~ pattern3)
if (match3.find()) {
return [true, match3.group(2)]
}
def pattern4 = "^(.*)(Add .* from commit .*)"
def match4 = (line =~ pattern4)
if (match4.find()) {
return [true, match4.group(2)]
}
return [false, line]
}
def extractjiraticketinfo(String line) {
bool result = true
return [result, [], line]
}
def DifferenceRecord fillrecord(meta, line) {
def DifferenceRecord dr = new DifferenceRecord()
@ -142,8 +178,26 @@ def DifferenceRecord fillrecord(meta, line) {
(sha, line2) = extractsha(line)
dr.sha = sha
dr.type = 0
dr.jiraticketinfo = "info"
(result, mergeinfo) = extractmerges(line2)
if (result) {
dr.type = 1
dr.jiraticketinfo = []
dr.mergeinfo = mergeinfo
dr.comment = ""
} else {
(result, jiraticketinfo, comment) = extractjiraticketinfo(line2)
if (result) {
dr.type = 2
dr.jiraticketinfo = jiraticketinfo
dr.mergeinfo = ""
dr.comment = comment
} else {
dr.type = 3
dr.jiraticketinfo = []
dr.mergeinfo = ""
df.comment = line2
}
}
return dr
}