Created
November 7, 2014 15:24
-
-
Save dlidstrom/9fbccb3ffe899be06c2d to your computer and use it in GitHub Desktop.
Can be used to get a record of which files were associated with which Jira issues.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#foreach line in the input, until empty line | |
# [DateTime]::Parse('2014-05-28 12:43:43 +0200', [System.Globalization.CultureInfo]::InvariantCulture) | |
# try some (known) variations | |
$regex = New-Object System.Text.RegularExpressions.Regex('(?i)(HMO-|HMO -|HMO |HMO - )(\d+)') | |
$issueNumbers = @{} | |
$input | % { $regex.Matches($_) } | % { | |
$issueNumber = "HMO-$($_.Groups[2])" | |
if (-not $issueNumbers.ContainsKey($issueNumber)) | |
{ | |
$issueNumber | |
} | |
$issueNumbers[$issueNumber] = $true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(Mandatory=$true, HelpMessage="Supply path to repository")] | |
$Repository | |
) | |
$env:TERM = "msys" | |
$git = "${env:ProgramFiles(x86)}\Git\cmd\git.exe" | |
& $git "log" "--name-only" "--pretty=format:%h %ai %s" "--all" "--no-merges" "--since=6.months.ago" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(Mandatory=$true, HelpMessage="Supply path to repository")] | |
$Repository | |
) | |
$env:TERM = "msys" | |
$git = "${env:ProgramFiles(x86)}\Git\cmd\git.exe" | |
& $git "log" "--name-only" "--pretty=format:%h %ai %s" "--all" "--no-merges" "--since=6.months.ago" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# General idea: | |
# Foreach branch in origin: | |
# Foreach log entry since last checkpoint | |
# Foreach file in log entry | |
# Store file as a change set | |
# | |
# get branches using: git ls-remote --heads origin | |
# get name of current branch: git rev-parse --abbrev-ref HEAD | |
# get all logs using: git log --name-only --pretty=format:"%h %ai %s" --all --no-merges --since=6.months.ago | |
trap { | |
$_ | |
} | |
$username = "tempdalid" | |
$password = [Text.Encoding]::ASCII.GetString([Convert]::FromBase64String("pwd-base-64-fmt")) | |
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password))) | |
$input | % { | |
$issue = Invoke-RestMethod -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -ContentType "application/json" -Uri http://jira.hm.com/rest/api/2/issue/$_ | |
"$_ $($issue.fields.issuetype.name)" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment