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
function Get-LinesChanged() { | |
$diffFromCommonBase = git diff origin/master...HEAD --unified=0 --dst-prefix="" | |
$linesByFile = @{} | |
$currentLines = New-Object System.Collections.ArrayList | |
foreach ($diffLine in $diffFromCommonBase ) { | |
if ($diffLine.StartsWith("+++")) { | |
#e.g. "+++ Path/to/file.cs" -> "Path/to/file.cs" | |
$currentFile = $diffLine.Substring(4) | |
$currentLines = $linesByFile[$currentFile] = New-Object System.Collections.ArrayList |
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
public static class DictionaryExtensions | |
{ | |
public static TValue Get<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dict, TKey key, TValue defaultValue = default(TValue)) | |
=> dict.TryGetValue(key, out var actualValue) ? actualValue : defaultValue; | |
public static TValue Get<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key, TValue defaultValue = default(TValue)) | |
=> dict.TryGetValue(key, out var actualValue) ? actualValue : defaultValue; | |
public static TValue Get<TKey, TValue>(this Dictionary<TKey, TValue> dict, TKey key, TValue defaultValue = default(TValue)) |