Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Support for subrepositories #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions HgPrompt.ps1
Expand Up @@ -42,6 +42,11 @@ function Write-HgStatus($status = (get-hgStatus $global:PoshHgSettings.GetFileSt
if($status.Renamed) {
Write-Host "$($s.RenamedStatusPrefix)$($status.Renamed)" -NoNewline -BackgroundColor $s.RenamedBackgroundColor -ForegroundColor $s.RenamedForegroundColor
}

if($status.Subrepos) {
Write-Host "$($s.SubreposStatusPrefix)$($status.Subrepos)" -NoNewline -BackgroundColor $s.SubreposBackgroundColor -ForegroundColor $s.SubreposForegroundColor
}


if($s.ShowTags -and ($status.Tags.Length -or $status.ActiveBookmark.Length)) {
write-host $s.BeforeTagText -NoNewLine
Expand Down
5 changes: 4 additions & 1 deletion HgUtils.ps1
Expand Up @@ -30,6 +30,7 @@ function Get-HgStatus($getFileStatus=$true, $getBookmarkStatus=$true) {
$modified = 0
$deleted = 0
$missing = 0
$subrepos = 0
$renamed = 0
$tags = @()
$commit = ""
Expand Down Expand Up @@ -74,6 +75,7 @@ function Get-HgStatus($getFileStatus=$true, $getBookmarkStatus=$true) {
'(\d+) deleted' { $missing = $matches[1] }
'(\d+) unknown' { $untracked = $matches[1] }
'(\d+) renamed' { $renamed = $matches[1] }
'(\d+) subrepos' { $subrepos = $matches[1] }
}
}
}
Expand Down Expand Up @@ -103,7 +105,8 @@ function Get-HgStatus($getFileStatus=$true, $getBookmarkStatus=$true) {
"Behind" = $behind;
"MultipleHeads" = $multipleHeads;
"ActiveBookmark" = $active;
"Branch" = $branch}
"Branch" = $branch;
"Subrepos" = $subrepos}
}
}

Expand Down
7 changes: 4 additions & 3 deletions README.md
Expand Up @@ -40,23 +40,24 @@ PowerShell generates its prompt by executing a `prompt` function, if one exists.

By default, the status summary has the following format:

[{HEAD-name} +A ~B -C ?D !E ^F]
[{HEAD-name} +A ~B -C ?D !E ^F subrepos~G]

* `{HEAD-name}` is the current branch, or the SHA of a detached HEAD
* Cyan means the branch matches its remote
* Red means the branch is behind its remote
* ABCDEF represent the working directory
* ABCDEFG represent the working directory
* `+` = Added files
* `~` = Modified files
* `-` = Removed files
* `?` = Untracked files
* `!` = Missing files
* `^` = Renamed files
* `subrepos~` = Changed subrepositories

Additionally, Posh-Hg can show any tags and bookmarks in the prompt as well as MQ patches if the MQ extension is enabled (disabled by default)

### Based on work by:

- Jeremy Skinner, http://www.jeremyskinner.co.uk/
- Keith Dahlby, http://solutionizing.net/
- Mark Embling, http://www.markembling.info/
- Mark Embling, http://www.markembling.info/
5 changes: 4 additions & 1 deletion Settings.ps1
Expand Up @@ -26,7 +26,9 @@ $global:PoshHgSettings = New-Object PSObject -Property @{
# Working directory status
AddedForegroundColor = [ConsoleColor]::Green
AddedBackgroundColor = $Host.UI.RawUI.BackgroundColor
ModifiedForegroundColor = [ConsoleColor]::Blue
SubreposForegroundColor = [ConsoleColor]::Blue
SubreposBackgroundColor = $Host.UI.RawUI.BackgroundColor
ModifiedForegroundColor = [ConsoleColor]::Blue
ModifiedBackgroundColor = $Host.UI.RawUI.BackgroundColor
DeletedForegroundColor = [ConsoleColor]::Red
DeletedBackgroundColor = $Host.UI.RawUI.BackgroundColor
Expand Down Expand Up @@ -62,4 +64,5 @@ $global:PoshHgSettings = New-Object PSObject -Property @{
UntrackedStatusPrefix = ' ?'
MissingStatusPrefix = ' !'
RenamedStatusPrefix = ' ^'
SubreposStatusPrefix = ' subrepos~'
}