mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2024-10-27 20:34:23 +00:00
[bobthefish] Use @rominf's recursive hg to find hg root.
This commit is contained in:
parent
94f04d7260
commit
f108e89f1a
@ -75,17 +75,6 @@ set __bobthefish_lt_brown BF5E00
|
|||||||
# command which hg > /dev/null 2>&1; and command hg stat > /dev/null 2>&1
|
# command which hg > /dev/null 2>&1; and command hg stat > /dev/null 2>&1
|
||||||
# end
|
# end
|
||||||
|
|
||||||
function __bobthefish_check_hg_dir_recursively -d 'Check whether pwd or parents contain .hg dir'
|
|
||||||
set d (pwd)
|
|
||||||
while not [ $d = / ]
|
|
||||||
if test -e $d/.hg
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
set d (dirname $d)
|
|
||||||
end
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
function __bobthefish_git_branch -d 'Get the current git branch (or commitish)'
|
function __bobthefish_git_branch -d 'Get the current git branch (or commitish)'
|
||||||
set -l ref (command git symbolic-ref HEAD ^/dev/null)
|
set -l ref (command git symbolic-ref HEAD ^/dev/null)
|
||||||
if [ $status -gt 0 ]
|
if [ $status -gt 0 ]
|
||||||
@ -110,7 +99,14 @@ function __bobthefish_git_project_dir -d 'Print the current git project base dir
|
|||||||
end
|
end
|
||||||
|
|
||||||
function __bobthefish_hg_project_dir -d 'Print the current hg project base directory'
|
function __bobthefish_hg_project_dir -d 'Print the current hg project base directory'
|
||||||
command hg root ^/dev/null
|
set d (pwd)
|
||||||
|
while not [ $d = / ]
|
||||||
|
if test -e $d/.hg
|
||||||
|
command hg root ^/dev/null
|
||||||
|
return
|
||||||
|
end
|
||||||
|
set d (dirname $d)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function __bobthefish_project_pwd -d 'Print the working directory relative to project root'
|
function __bobthefish_project_pwd -d 'Print the working directory relative to project root'
|
||||||
|
Loading…
Reference in New Issue
Block a user