-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from StartAutomating/ugit-file-diffs
ugit 0.3.9
- Loading branch information
Showing
22 changed files
with
668 additions
and
35 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
Write-FormatView -TypeName Git.Log -Property GitUserName, CommitDate, CommitMessage -Wrap | ||
Write-FormatView -TypeName Git.Log -Property GitUserName, CommitDate, CommitMessage -Wrap -AlignProperty @{ | ||
"CommitDate" = "Right" | ||
"CommitMessage" = "Left" | ||
} | ||
|
||
Write-FormatView -TypeName Git.Log -Property GitUserName, CommitDate, CommitHash, CommitMessage -Wrap -Name IncludeCommitHash | ||
Write-FormatView -TypeName Git.Log -Property GitUserName, CommitDate, CommitHash, CommitMessage -Wrap -Name IncludeCommitHash -AlignProperty @{ | ||
"CommitDate" = "Right" | ||
"CommitHash" = "Left" | ||
"CommitMessage" = "Left" | ||
} | ||
|
||
Write-FormatView -TypeName Git.Merge.Log -Property GitUserName, CommitDate, MergeHash, CommitMessage -Wrap | ||
Write-FormatView -TypeName Git.Merge.Log -Property GitUserName, CommitDate, MergeHash, CommitMessage -Wrap -AlignProperty @{ | ||
"CommitDate" = "Right" | ||
"CommitHash" = "Left" | ||
"MergeHash" = "Left" | ||
"CommitMessage" = "Left" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Write-FormatView -TypeName ugit.extension -Property DisplayName, Synopsis -AutoSize | ||
|
||
Write-FormatView -TypeName ugit.extension -Property DisplayName, Pattern -Name Pattern -AutoSize |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@{ | ||
'GitLog' = 'GitLogs' | ||
'GitDifference' = 'GitDiff' | ||
'Diff' = 'GitDiff' | ||
'Logs' = 'GitLogs' | ||
'GitHistory' = 'GitChanges' | ||
'Changes' = 'GitChanges' | ||
'History' = 'GitChanges' | ||
'HasChanged' = 'GitDirty' | ||
'HasChanges' = 'GitDirty' | ||
'IsUnstaged' = 'GitDirty' | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<# | ||
.SYNOPSIS | ||
Get Changes for a given file | ||
.DESCRIPTION | ||
Gets changes from git for a given file. Can provide a timespan, series of numbers, date, or pair of dates. | ||
#> | ||
|
||
$byDate = @() | ||
$byNumber = @() | ||
$byTimespan = @() | ||
foreach ($arg in $args) { | ||
if ($arg -as [int] -ne $null) { | ||
$byNumber += $arg -as [int] | ||
} | ||
elseif ($arg -is [object[]]) { | ||
$byNumber += $arg | ||
} | ||
elseif ($arg -as [DateTime]) { | ||
$byDate+= $arg -as [DateTime] | ||
} | ||
elseif ( | ||
$arg -as [TimeSpan] | ||
) { | ||
$byTimespan+= $arg -as [TimeSpan] | ||
} | ||
} | ||
|
||
Push-Location $this.Directory | ||
|
||
|
||
|
||
if ($byTimespan) { | ||
git log -Since ([DateTime]::Now - $byTimespan[0]) $this.Name | ||
} | ||
elseif ($byDate) { | ||
if ($byDate.Length -gt 1) { | ||
$first, $second = $byDate | Sort-Object | ||
git log -After $second -Before $first $this.Name | ||
} elseif ($byDate.Length -eq 1) { | ||
git log -Since $byDate[0] $this.Name | ||
} else { | ||
throw "Can only list Changes between two dates" | ||
} | ||
} | ||
elseif ($byNumber.Length) { | ||
$maxNumber = $byNumber | Measure-Object -Maximum | Select-Object -ExpandProperty Maximum | ||
$maxNumber = $maxNumber + 1 | ||
$anyNegative = @($byNumber -lt 0).Length | ||
|
||
if ($anyNegative) { | ||
@(git log $this.Name)[@($byNumber -as [int[]])] | ||
} else { | ||
@(git log -n $maxNumber $this.Name)[@($byNumber -as [int[]])] | ||
} | ||
} | ||
else { | ||
git log $this.Name | ||
} | ||
|
||
Pop-Location |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Push-Location $this.Directory | ||
(git log -n 1 $this.Name).Diff() | ||
Pop-Location |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Push-Location $this.Directory | ||
$(git status $this.Name '-s') -as [bool] | ||
Pop-Location |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Push-Location $this.Directory | ||
git log $this.Name | ||
Pop-Location |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@{ | ||
HasUpstream = 'IsTracked' | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Push-Location $this.GitRoot | ||
( | ||
git remote | | ||
git remote show | | ||
Select-Object -ExpandProperty RemoteBranches | | ||
Where-Object BranchName -like "*$($this.BranchName)" | ||
) -as [bool] | ||
Pop-Location |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
Push-Location $this.GitRoot | ||
$logPaths = @($this.GitArgument -ne 'log' -notmatch '^\-') | ||
$logPaths = @($this.GitCommand -split '\s' -notmatch '^(?>git|log)$' -notmatch '^\-' -ne '') | ||
Write-Debug "Logging paths: $logPaths" | ||
foreach ($logPath in $logPaths) { | ||
if (Test-Path $logPath) { | ||
$relativeArgs = @("--relative", $logPath) | ||
git diff $this.CommitHash @relativeArgs @args | ||
} | ||
} | ||
if (-not $logPaths) { | ||
Write-Debug "Getting diff of commit hash: $($this.CommitHash)" | ||
git diff $this.CommitHash @args | ||
} | ||
Pop-Location |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
foreach ($attr in $this.ScriptBlock.Attributes) { | ||
if ($attr -is [Management.Automation.ValidatePatternAttribute]) { | ||
$attr.RegexPattern | ||
} | ||
} |
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
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
Oops, something went wrong.