Restoration of subtree contents

This commit is contained in:
Dan Hawkins 2018-11-30 18:20:30 +00:00
commit b380eef774

View file

@ -10,18 +10,43 @@ def getGitRevision(String gitrootpath, int basebuildnumber) {
def String remoteinfo
def String remoteurl
dir( gitrootpath) {
def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim()
def int changecount
if (isUnix()) {
changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim()
}
else {
def stdout = bat(returnStdout:true , script: "git rev-list HEAD --count").trim()
changecount = stdout.readLines()[1] as int
}
echo "Change count: ${changecount}"
adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1)
echo "Adjusted change count: ${adjustedchangecount}"
gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
if (isUnix()) {
gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
}
else {
def stdout = bat(returnStdout:true , script: "git rev-parse HEAD").trim()
gitrevision = stdout.readLines()[1]
}
echo "Revision: ${gitrevision}"
remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim()
if (isUnix()) {
remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim()
}
else {
def stdout = bat(returnStdout:true , script: "git remote show origin").trim()
remoteinfo = stdout.readLines()[1..-1]
}
echo "Remote info: ${remoteinfo}"
remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim()
if (isUnix()) {
remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim()
}
else {
def stdout = bat(returnStdout:true , script: "git config --get remote.origin.url").trim()
remoteurl = stdout.readLines()[1]
}
echo "Remote URL: ${remoteurl}"
}
return [adjustedchangecount, gitrevision, remoteinfo, remoteurl]