From d5e630dd9280bd78374f4ae28b5df8b4a8c29784 Mon Sep 17 00:00:00 2001 From: skalinets Date: Tue, 12 Mar 2013 08:29:55 +0200 Subject: [PATCH 1/2] added # of changes in subrepos to prompt --- HgPrompt.ps1 | 5 +++++ HgUtils.ps1 | 5 ++++- Settings.ps1 | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/HgPrompt.ps1 b/HgPrompt.ps1 index 7348c10..d462e20 100644 --- a/HgPrompt.ps1 +++ b/HgPrompt.ps1 @@ -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 diff --git a/HgUtils.ps1 b/HgUtils.ps1 index f654d9a..41e0551 100644 --- a/HgUtils.ps1 +++ b/HgUtils.ps1 @@ -30,6 +30,7 @@ function Get-HgStatus($getFileStatus=$true, $getBookmarkStatus=$true) { $modified = 0 $deleted = 0 $missing = 0 + $subrepos = 0 $renamed = 0 $tags = @() $commit = "" @@ -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] } } } } @@ -103,7 +105,8 @@ function Get-HgStatus($getFileStatus=$true, $getBookmarkStatus=$true) { "Behind" = $behind; "MultipleHeads" = $multipleHeads; "ActiveBookmark" = $active; - "Branch" = $branch} + "Branch" = $branch; + "Subrepos" = $subrepos} } } diff --git a/Settings.ps1 b/Settings.ps1 index 78b8441..c26e11b 100644 --- a/Settings.ps1 +++ b/Settings.ps1 @@ -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 @@ -62,4 +64,5 @@ $global:PoshHgSettings = New-Object PSObject -Property @{ UntrackedStatusPrefix = ' ?' MissingStatusPrefix = ' !' RenamedStatusPrefix = ' ^' + SubreposStatusPrefix = ' subrepos~' } \ No newline at end of file From 51204bd54c2686e10b6f00d721b327015e390c07 Mon Sep 17 00:00:00 2001 From: skalinets Date: Tue, 12 Mar 2013 11:47:29 +0200 Subject: [PATCH 2/2] udpated Readme with subrepos changes --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 98c80fe..32b0674 100644 --- a/README.md +++ b/README.md @@ -40,18 +40,19 @@ 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) @@ -59,4 +60,4 @@ Additionally, Posh-Hg can show any tags and bookmarks in the prompt as well as M - Jeremy Skinner, http://www.jeremyskinner.co.uk/ - Keith Dahlby, http://solutionizing.net/ - - Mark Embling, http://www.markembling.info/ \ No newline at end of file + - Mark Embling, http://www.markembling.info/