Octopus.Script exported 2016-09-19 by avonwyss belongs to ‘Mercurial’ category.
Generate exact changelog from Mercurial commit history. It is stored in the output variable “Changelog”.
Requirement: each release must have been labeled in the repository as “release-OctopusReleaseNumber” (for instance using VCS labeling feature of TeamCity).
See http://hgbook.red-bean.com/read/customizing-the-output-of-mercurial.html for template format.
Parameters
When steps based on the template are included in a project’s deployment process, the parameters below can be set.
Repository Path
HgRepository
The Mercurial repository to use for generating the changelog.
The repo path needs to be local to where the step is executed because Mercurial does not support remote log listing.
Template = <li>{date|shortdate} ({date|age} in {branch|escape}): {desc|strip|escape|addbreaks}</li>
Default template generates HTML <li> elements for inclusion in a <ul> (not part of the step output).
Script body
Steps based on this template will execute the following PowerShell script.
If ($OctopusParameters["Octopus.Release.CurrentForEnvironment.Number"]) {
$prm = @('log',
'-r',"ancestors('release-$($OctopusParameters["Octopus.Release.Number"])') - ancestors('release-$($OctopusParameters["Octopus.Release.CurrentForEnvironment.Number"])')",
'-T',$Template,
'--repository',$HgRepository)
Write-Host Getting changelog on $prm[6] '[' $prm[2] ']'
$changelog = & hg $prm
}
Else {
$changelog = "<li><i>(no changelog available)</i></li>"
}
Write-Verbose $changelog
Set-OctopusVariable -name "Changelog" -value $changelog
Provided under the Apache License version 2.0.
To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.
{
"Id": "1f76dc61-c7ec-47a8-bd27-fb135851e9c5",
"Name": "HG - Get Changelog",
"Description": "Generate exact changelog from Mercurial commit history. It is stored in the output variable \"Changelog\".\n\nRequirement: each release must have been labeled in the repository as \"release-OctopusReleaseNumber\" (for instance using VCS labeling feature of TeamCity).\n\nSee http://hgbook.red-bean.com/read/customizing-the-output-of-mercurial.html for template format.",
"Version": 17,
"ExportedAt": "2016-09-19T18:10:27.463+00:00",
"ActionType": "Octopus.Script",
"Author": "avonwyss",
"Parameters": [
{
"Id": "9a308d93-915c-4216-a0a6-cbe8de108064",
"Name": "HgRepository",
"Label": "Repository Path",
"HelpText": "The Mercurial repository to use for generating the changelog.\n\nThe repo path needs to be local to where the step is executed because Mercurial does not support remote log listing.",
"DefaultValue": null,
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "57f225d5-4579-442f-ac3c-725743952f09",
"Name": "Template",
"Label": "",
"HelpText": "Default template generates HTML <li> elements for inclusion in a <ul> (not part of the step output).",
"DefaultValue": "<li>{date|shortdate} ({date|age} in {branch|escape}): {desc|strip|escape|addbreaks}</li>",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
}
],
"Properties": {
"Octopus.Action.Script.Syntax": "PowerShell",
"Octopus.Action.Script.ScriptSource": "Inline",
"Octopus.Action.RunOnServer": "false",
"Octopus.Action.Script.ScriptBody": "If ($OctopusParameters[\"Octopus.Release.CurrentForEnvironment.Number\"]) {\n $prm = @('log',\n \t'-r',\"ancestors('release-$($OctopusParameters[\"Octopus.Release.Number\"])') - ancestors('release-$($OctopusParameters[\"Octopus.Release.CurrentForEnvironment.Number\"])')\",\n \t'-T',$Template,\n \t'--repository',$HgRepository)\n Write-Host Getting changelog on $prm[6] '[' $prm[2] ']'\n $changelog = & hg $prm\n}\nElse {\n $changelog = \"<li><i>(no changelog available)</i></li>\"\n}\nWrite-Verbose $changelog\nSet-OctopusVariable -name \"Changelog\" -value $changelog",
"Octopus.Action.Script.ScriptFileName": null,
"Octopus.Action.Package.FeedId": null,
"Octopus.Action.Package.PackageId": null
},
"Category": "Mercurial",
"HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/hg-get-changelog.json",
"Website": "/step-templates/1f76dc61-c7ec-47a8-bd27-fb135851e9c5",
"Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADBQTFRF////mZmZ0dHRAQEBa2trv7+/Li4uqKioSUlJiIiIGRkZ4uLi8/Pzs7OzoKCg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