Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge the Posh‑Hg repository into the Posh‑Git repository #614

Open
wants to merge 86 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
23bdefa
Creating posh-hg module from local scripts
JeremySkinner Apr 5, 2010
5aa17a5
Sample profile (ported from posh-git)
JeremySkinner Apr 5, 2010
6b87973
Merge HgTabExpansion and HgTkTabExpansion functions
JeremySkinner Apr 9, 2010
5a97bb9
Forgot to commit updated module
JeremySkinner Apr 9, 2010
bbf07dc
Add tab completion for options
bmsullivan Apr 25, 2010
90443ac
Fix for options that don't have a single character abbreviation
bmsullivan Apr 25, 2010
19543c2
Hg tab expansion now handles hg revert <path>
JeremySkinner Apr 26, 2010
3d68504
Added support for "hg add <path>" tab expansion
JeremySkinner Apr 26, 2010
d970b43
Cleanup
JeremySkinner Apr 26, 2010
6758349
Updating readme
JeremySkinner Apr 26, 2010
5f5cc38
Update readme
JeremySkinner Apr 26, 2010
b7f6649
Handles hg diff <tab>
JeremySkinner May 14, 2010
93de0c6
"hg up <tab>" now shows completes branches (in addition to "hg update…
JeremySkinner May 19, 2010
de32815
Now handling "hg commit -X <tab>" and "hg commit -I <tab>"
JeremySkinner May 22, 2010
ddf6f33
Fixing line endings - autocrlf is now set to false
JeremySkinner May 23, 2010
cf70cac
Update readme
JeremySkinner May 23, 2010
1687ffd
Minor
JeremySkinner May 23, 2010
70ddcce
Added support for tags
JeremySkinner May 23, 2010
599b4e6
Support empty tags
JeremySkinner May 23, 2010
c3016e7
Prompt colouring detects when you're not up to date
JeremySkinner May 23, 2010
3da1c41
Now includes MQ commands in the tab completion
JeremySkinner May 24, 2010
8fe663f
Adding MQ prompt integration. Tab expansion to follow
JeremySkinner May 24, 2010
f256a4e
Tweak expansion for "hg commit -X <tab>" so that it works with other …
JeremySkinner Jun 3, 2010
7789403
Ensure tag list doesn't contain "empty repository"
JeremySkinner Jun 4, 2010
afa07bf
More efficient implmentation of Get-MqPatches
JeremySkinner Jun 18, 2010
8e6e8a6
Added separate settings file. Basic PBranch integration.
JeremySkinner Jun 18, 2010
00fe56b
Remove pbranch integration for now.
JeremySkinner Jun 18, 2010
df05530
Added support for 'Renamed' file status
vcaraulean Aug 17, 2010
aa2d0de
Exclude additional help topics from cmd list
JeremySkinner Jul 6, 2010
8abba7a
Adding the co and checkout aliases for tab expansion
jbogard Jan 27, 2011
802574d
Update to support tortoisehg 2.0 (now uses "thg" as the command line …
JeremySkinner Mar 2, 2011
8d847bf
Added color settings per status. Default values are the same of Mercu…
rstuven May 19, 2011
f7c106f
Merge pull request #2 from rstuven/master
JeremySkinner May 20, 2011
756c8d2
Modified tab extension and prompt to support bookmarks
matthewrfindley Jun 29, 2011
ee86685
Merge pull request #3 from matthewrfindley/master
JeremySkinner Jun 30, 2011
b8cdeeb
Fixed issue where branch names with spaces would only display the fir…
jpoehls Aug 25, 2011
140bd89
Merge pull request #4 from jpoehls/master
JeremySkinner Aug 25, 2011
663e3f3
Add Write-VcsStatus to easily support multiple VCS prompts
dahlbyk Jan 26, 2012
1bd7604
Export TabExpansion from module instead of defining in profile
dahlbyk Jan 26, 2012
70194c1
Add installer
dahlbyk Jan 26, 2012
d7ca024
Merge pull request #5 from dahlbyk/master
JeremySkinner Jan 27, 2012
392e1b7
Fixed issue with active bookmark not displaying
dfjacobs Jan 31, 2012
03feb88
Merge pull request #6 from dfjacobs/master
JeremySkinner Jan 31, 2012
7dddbe7
Short circuit git repo check
JeremySkinner Feb 7, 2012
04c4c56
Added tab expansion for tags
ekroon Mar 30, 2012
e08d4f7
Merge pull request #8 from ekroon/master
JeremySkinner Mar 31, 2012
489afd1
Make status prefixes configurable for issue 11.
Apr 19, 2012
1c3cf6b
Retreiving information on changes in files (number of modified/added/…
May 14, 2012
69d2136
Pass through settings for GetFileStatus and GetBookmarkStatus to Get-…
May 14, 2012
1220e52
When not using hg summary to get status, use hg heads to check if wor…
May 14, 2012
59aca0d
Fix 'variable not set' strict mode error
dahlbyk Aug 8, 2012
4908296
Detect when the current branch has multiple heads and indicate by cha…
petemill Aug 13, 2012
b0ff129
Update tab expansion to work with powershell 3
JeremySkinner Aug 17, 2012
8230d19
Use hg root to get relative paths
jrsconfitto Sep 6, 2012
22c3fda
Merge pull request #17 from jugglingnutcase/relative-path
JeremySkinner Sep 6, 2012
32e6781
Update readme
JeremySkinner Sep 6, 2012
1052628
Merge pull request #16 from dahlbyk/strict-mode
JeremySkinner Sep 6, 2012
86f9e9a
Convert readme to markdown
JeremySkinner Sep 6, 2012
ec2b952
Merge pull request #15 from petemill/master
JeremySkinner Sep 6, 2012
636235f
Merge pull request #12 from CraigStuntz/master
JeremySkinner Sep 6, 2012
92b0d09
Add paths expansion to outgoing, incoming
jrsconfitto Sep 7, 2012
f0db3ef
Added Get-AliasPattern to HgUtils similar to how it is in GitUtils
nathanpalmer Jan 22, 2013
016f4fc
Added hg flow patterns to HgTabExpansion
nathanpalmer Jan 22, 2013
9e76cd9
Added tab completion for streams and reading the names from the .hgfl…
nathanpalmer Jan 22, 2013
8c74833
Added local branches to the tab completion for hg flow
nathanpalmer Jan 23, 2013
ccaea63
Merge pull request #18 from jugglingnutcase/out-in-tab-expansion
JeremySkinner Jan 23, 2013
508c3e2
Merge pull request #20 from nathanpalmer/Get-AliasPattern
JeremySkinner Jan 23, 2013
460e414
Merge pull request #21 from nathanpalmer/HgFlowTabCompletion
JeremySkinner Jan 23, 2013
a362917
Refactored to allow both powertab's and the visual studio nuget conso…
eugeneduvenage Jul 6, 2013
4362ee9
The posh-hg prompt did not handle getting undefined background colors…
eugeneduvenage Jul 6, 2013
2cabd74
Merge pull request #23 from eugeneduvenage/master
JeremySkinner Jul 6, 2013
96934b1
preserve $lastexit code
maxslimmer Nov 6, 2014
cc8ee50
Merge pull request #30 from maxslimmer/patch-1
JeremySkinner Nov 6, 2014
3053e18
Avoid populating $error on module load
JeremySkinner Feb 9, 2015
489d71b
Use ProviderPath in prompt
JeremySkinner Feb 10, 2015
584fbc7
Added the HG revison information to the prompt in the format "<{rev}:…
Mar 20, 2015
8d6f3c1
Merge pull request #33 from raleighbuckner/master
JeremySkinner Mar 25, 2015
833d792
Updated the README to include info about the added revision information.
Mar 25, 2015
79f1827
Merge pull request #34 from raleighbuckner/master
JeremySkinner Mar 25, 2015
44ad3ed
Make tab expansion case-insensitive for branches, tags and bookmarks
woodyza Apr 7, 2015
0b86b0d
added ShowRevision setting for extra prompt config
jordanmorris Apr 9, 2015
9955cab
Merge pull request #36 from jordanmorris/show-revision-optional
JeremySkinner Apr 10, 2015
e273b0d
Merge pull request #35 from woodyza/master
JeremySkinner Apr 10, 2015
8fe8c9e
Update README.md
JeremySkinner Feb 27, 2018
6a812a0
Merge Posh-Hg into Posh-Git
ExE-Boss Aug 31, 2018
a25e26e
fix(posh-hg): Use new ANSI Write-Prompt function
ExE-Boss Aug 31, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions posh-hg/HgPrompt.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# For backwards compatibility
$global:HgPromptSettings = $global:PoshHgSettings

function Write-HgStatus($status = (get-hgStatus $global:PoshHgSettings.GetFileStatus $global:PoshHgSettings.GetBookmarkStatus)) {
if ($status) {
$s = $global:PoshHgSettings
$sb = [System.Text.StringBuilder]::new()

$branchFg = $s.BranchForegroundColor
$branchBg = $s.BranchBackgroundColor

if($status.Behind) {
$branchFg = $s.Branch2ForegroundColor
$branchBg = $s.Branch2BackgroundColor
}

if ($status.MultipleHeads) {
$branchFg = $s.Branch3ForegroundColor
$branchBg = $s.Branch3BackgroundColor
}

$sb | Write-Prompt $s.BeforeText -BackgroundColor $s.BeforeBackgroundColor -ForegroundColor $s.BeforeForegroundColor
$sb | Write-Prompt $status.Branch -BackgroundColor $branchBg -ForegroundColor $branchFg

if($status.Added) {
$sb | Write-Prompt "$($s.AddedStatusPrefix)$($status.Added)" -BackgroundColor $s.AddedBackgroundColor -ForegroundColor $s.AddedForegroundColor
}
if($status.Modified) {
$sb | Write-Prompt "$($s.ModifiedStatusPrefix)$($status.Modified)" -BackgroundColor $s.ModifiedBackgroundColor -ForegroundColor $s.ModifiedForegroundColor
}
if($status.Deleted) {
$sb | Write-Prompt "$($s.DeletedStatusPrefix)$($status.Deleted)" -BackgroundColor $s.DeletedBackgroundColor -ForegroundColor $s.DeletedForegroundColor
}

if ($status.Untracked) {
$sb | Write-Prompt "$($s.UntrackedStatusPrefix)$($status.Untracked)" -BackgroundColor $s.UntrackedBackgroundColor -ForegroundColor $s.UntrackedForegroundColor
}

if($status.Missing) {
$sb | Write-Prompt "$($s.MissingStatusPrefix)$($status.Missing)" -BackgroundColor $s.MissingBackgroundColor -ForegroundColor $s.MissingForegroundColor
}

if($status.Renamed) {
$sb | Write-Prompt "$($s.RenamedStatusPrefix)$($status.Renamed)" -BackgroundColor $s.RenamedBackgroundColor -ForegroundColor $s.RenamedForegroundColor
}

if($s.ShowTags -and ($status.Tags.Length -or $status.ActiveBookmark.Length)) {
$sb | Write-Prompt $s.BeforeTagText -NoNewLine

if($status.ActiveBookmark.Length) {
$sb | Write-Prompt $status.ActiveBookmark -ForegroundColor $s.BranchForegroundColor -BackgroundColor $s.TagBackgroundColor
if($status.Tags.Length) {
$sb | Write-Prompt " " -ForegroundColor $s.TagSeparatorColor -BackgroundColor $s.TagBackgroundColor
}
}

$tagCounter=0
$status.Tags | % {
$color = $s.TagForegroundColor

$sb | Write-Prompt $_ -ForegroundColor $color -BackgroundColor $s.TagBackgroundColor

if($tagCounter -lt ($status.Tags.Length -1)) {
$sb | Write-Prompt ", " -ForegroundColor $s.TagSeparatorColor -BackgroundColor $s.TagBackgroundColor
}
$tagCounter++;
}
}

if($s.ShowPatches) {
$patches = Get-MqPatches
if($patches.All.Length) {
$sb | Write-Prompt $s.BeforePatchText -NoNewLine

$patchCounter = 0

$patches.Applied | % {
$sb | Write-Prompt $_ -ForegroundColor $s.AppliedPatchForegroundColor -BackgroundColor $s.AppliedPatchBackgroundColor
if($patchCounter -lt ($patches.All.Length -1)) {
$sb | Write-Prompt $s.PatchSeparator -ForegroundColor $s.PatchSeparatorColor
}
$patchCounter++;
}

$patches.Unapplied | % {
$sb | Write-Prompt $_ -ForegroundColor $s.UnappliedPatchForegroundColor -BackgroundColor $s.UnappliedPatchBackgroundColor
if($patchCounter -lt ($patches.All.Length -1)) {
$sb | Write-Prompt $s.PatchSeparator -ForegroundColor $s.PatchSeparatorColor
}
$patchCounter++;
}
}
}

if($s.ShowRevision -and $status.Revision) {
$sb | Write-Prompt " <" -BackgroundColor $s.TagBackgroundColor -ForegroundColor $s.TagForegroundColor
$sb | Write-Prompt $status.Revision -BackgroundColor $s.TagBackgroundColor -ForegroundColor $s.TagForegroundColor
$sb | Write-Prompt ">" -BackgroundColor $s.TagBackgroundColor -ForegroundColor $s.TagForegroundColor
}


$sb | Write-Prompt $s.AfterText -BackgroundColor $s.AfterBackgroundColor -ForegroundColor $s.AfterForegroundColor

$sb.ToString()
}
}

# Add scriptblock that will execute for Write-VcsStatus
$Global:VcsPromptStatuses += {
Write-HgStatus
}
Loading