Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
c1b798af
Unverified
Commit
c1b798af
authored
Feb 18, 2020
by
Marc Cornellà
Committed by
GitHub
Feb 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agnoster: fix bzr prompt with breezy installed (#8646)
* Change indentation to 2 spaces in prompt_bzr function * Check if in a bzr repository and optimize bzr calls in prompt_bzr
parent
eeb49bf5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
17 deletions
+23
-17
agnoster.zsh-theme
themes/agnoster.zsh-theme
+23
-17
No files found.
themes/agnoster.zsh-theme
View file @
c1b798af
...
...
@@ -140,24 +140,30 @@ prompt_git() {
}
prompt_bzr
()
{
((
$+
commands[bzr]
))
||
return
if
(
bzr status
>
/dev/null 2>&1
)
;
then
status_mod
=
`
bzr status |
head
-n1
|
grep
"modified"
|
wc
-m
`
status_all
=
`
bzr status |
head
-n1
|
wc
-m
`
revision
=
`
bzr log |
head
-n2
|
tail
-n1
|
sed
's/^revno: //'
`
if
[[
$status_mod
-gt
0
]]
;
then
prompt_segment yellow black
echo
-n
"bzr@"
$revision
"✚ "
else
if
[[
$status_all
-gt
0
]]
;
then
prompt_segment yellow black
echo
-n
"bzr@"
$revision
else
prompt_segment green black
echo
-n
"bzr@"
$revision
fi
fi
((
$+
commands[bzr]
))
||
return
# Test if bzr repository in directory hierarchy
local dir
=
"
$PWD
"
while
[[
!
-d
"
$dir
/.bzr"
]]
;
do
[[
"
$dir
"
=
"/"
]]
&&
return
dir
=
"
${
dir
:h
}
"
done
local
bzr_status status_mod status_all revision
if
bzr_status
=
$(
bzr status 2>&1
)
;
then
status_mod
=
$(
echo
-n
"
$bzr_status
"
|
head
-n1
|
grep
"modified"
|
wc
-m
)
status_all
=
$(
echo
-n
"
$bzr_status
"
|
head
-n1
|
wc
-m
)
revision
=
$(
bzr log
-r-1
--log-format
line |
cut
-d
:
-f1
)
if
[[
$status_mod
-gt
0
]]
;
then
prompt_segment yellow black
"bzr@
$revision
✚"
else
if
[[
$status_all
-gt
0
]]
;
then
prompt_segment yellow black
"bzr@
$revision
"
else
prompt_segment green black
"bzr@
$revision
"
fi
fi
fi
}
prompt_hg
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment