78:e9fd8738ae54
Anton Shestakov <engored@ya.ru>, 2015-01-25
prompt: trailing spaces

next change 88:f5cd956da0c3
previous change 69:3e6ac54990dd

.bash_prompt

Permissions: -rw-r--r--

Other formats: Feeds:
0
0:226664158c55 Added .bashrc with hg prompt example.
Anton Shestakov <engored@ya.ru>
previous changes:
line | diff
#!/bin/bash
0:226664158c55 Added .bashrc with hg prompt example.
Anton Shestakov <engored@ya.ru>
previous changes:
line | diff
42
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
function prompt_command {
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
local RETURN_CODE="$?"
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
# dark, light, bold
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
local Rd="\[\e[0;31m\]"; local R="\[\e[0;91m\]"; local Rb="\[\e[1;31m\]"
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
local Gd="\[\e[0;32m\]"; local G="\[\e[0;92m\]"; local Gb="\[\e[1;32m\]"
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
local Yd="\[\e[0;33m\]"; local Y="\[\e[0;93m\]"; local Yb="\[\e[1;33m\]"
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
local Bd="\[\e[0;34m\]"; local B="\[\e[0;94m\]"; local Bb="\[\e[1;34m\]"
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
local Pd="\[\e[0;35m\]"; local P="\[\e[0;95m\]"; local Pb="\[\e[1;35m\]"
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
local Cd="\[\e[0;36m\]"; local C="\[\e[0;96m\]"; local Cb="\[\e[1;36m\]"
35
35:44a6ddc7f222 Unlocal colors, lose double quotes where not needed.
Anton Shestakov <engored@ya.ru>
previous changes: 34:6d42e8d89e7e
line | diff
42
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
if [[ $TERM == 'linux' ]] ; then
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
R=$Rb
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
G=$Gb
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
Y=$Yb
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
B=$Bb
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
P=$Pb
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
C=$Cb
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
fi
35
35:44a6ddc7f222 Unlocal colors, lose double quotes where not needed.
Anton Shestakov <engored@ya.ru>
previous changes: 34:6d42e8d89e7e
line | diff
42
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
local BOLD="\[\e[1m\]"
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
local RESET="\[\e[0m\]"
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
local TIME="${G}\t${RESET}"
35
35:44a6ddc7f222 Unlocal colors, lose double quotes where not needed.
Anton Shestakov <engored@ya.ru>
previous changes: 34:6d42e8d89e7e
line | diff
42
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
if [[ $RETURN_CODE != 0 ]] ; then
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
local RETCODE="${R}${RETURN_CODE}${RESET} "
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
fi
42:34ee83bd5ad2 local again. Lotsa colors. hg prompt is back, controlled by USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 40:48d26a4c35ba
line | diff
35
35:44a6ddc7f222 Unlocal colors, lose double quotes where not needed.
Anton Shestakov <engored@ya.ru>
previous changes: 34:6d42e8d89e7e
line | diff
if [[ $EUID == 0 ]] ; then
3
3:cb307dcaf2ef More quotes.
Anton Shestakov <engored@ya.ru>
previous changes: 2:9c916e36d032
line | diff
local PROMPT_COLOR="$R"
78
78:e9fd8738ae54 prompt: trailing spaces
Anton Shestakov <engored@ya.ru>
previous changes: 69:3e6ac54990dd
line | diff
7
7:d3613e95e03f Git info. Git and Mercurial symbols (credit goes to Steve Losh and his extravagant zsh prompt).
Anton Shestakov <engored@ya.ru>
previous changes: 5:7b2ad8123a53
line | diff
# getting hg and git info is disabled for root
5
5:7b2ad8123a53 virtualenv support.
Anton Shestakov <engored@ya.ru>
previous changes: 3:cb307dcaf2ef
line | diff
local HG_INFO=" ${P}-${RESET}"
7
7:d3613e95e03f Git info. Git and Mercurial symbols (credit goes to Steve Losh and his extravagant zsh prompt).
Anton Shestakov <engored@ya.ru>
previous changes: 5:7b2ad8123a53
line | diff
local GIT_INFO=" ${G}-${RESET}"
2
2:9c916e36d032 Renamed .bashrc to .bash_prompt. Disabled any hg interaction for root.
Anton Shestakov <engored@ya.ru>
previous changes: 1:ef4ec926e9a4
line | diff
else
3
3:cb307dcaf2ef More quotes.
Anton Shestakov <engored@ya.ru>
previous changes: 2:9c916e36d032
line | diff
local PROMPT_COLOR="$G"
78
78:e9fd8738ae54 prompt: trailing spaces
Anton Shestakov <engored@ya.ru>
previous changes: 69:3e6ac54990dd
line | diff
65
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
case "$(_upsearch)" in
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
'hg')
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
local HG_INFO=
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
_set_hg_info
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
;;
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
'git')
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
local GIT_INFO=
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
_set_git_info
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
;;
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
esac
0
0:226664158c55 Added .bashrc with hg prompt example.
Anton Shestakov <engored@ya.ru>
previous changes:
line | diff
fi
0:226664158c55 Added .bashrc with hg prompt example.
Anton Shestakov <engored@ya.ru>
previous changes:
line | diff
35
35:44a6ddc7f222 Unlocal colors, lose double quotes where not needed.
Anton Shestakov <engored@ya.ru>
previous changes: 34:6d42e8d89e7e
line | diff
if [[ $VIRTUAL_ENV ]] ; then
5
5:7b2ad8123a53 virtualenv support.
Anton Shestakov <engored@ya.ru>
previous changes: 3:cb307dcaf2ef
line | diff
local VENV="${G}+"$(basename "$VIRTUAL_ENV")"${RESET}"
5:7b2ad8123a53 virtualenv support.
Anton Shestakov <engored@ya.ru>
previous changes: 3:cb307dcaf2ef
line | diff
fi
5:7b2ad8123a53 virtualenv support.
Anton Shestakov <engored@ya.ru>
previous changes: 3:cb307dcaf2ef
line | diff
0
0:226664158c55 Added .bashrc with hg prompt example.
Anton Shestakov <engored@ya.ru>
previous changes:
line | diff
PS1="\
45
45:a12c1aeefbfe Let's try without bold at all.
Anton Shestakov <engored@ya.ru>
previous changes: 44:a6137e70b11c
line | diff
[${TIME} \u@\h \
45:a12c1aeefbfe Let's try without bold at all.
Anton Shestakov <engored@ya.ru>
previous changes: 44:a6137e70b11c
line | diff
${RETCODE}\W${VENV}${HG_INFO}${GIT_INFO}]\
0
0:226664158c55 Added .bashrc with hg prompt example.
Anton Shestakov <engored@ya.ru>
previous changes:
line | diff
${PROMPT_COLOR}\\\$${RESET} "
0:226664158c55 Added .bashrc with hg prompt example.
Anton Shestakov <engored@ya.ru>
previous changes:
line | diff
}
0:226664158c55 Added .bashrc with hg prompt example.
Anton Shestakov <engored@ya.ru>
previous changes:
line | diff
65
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
function _upsearch {
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
test "$PWD" == '/' && return || test -e '.hg' && echo 'hg' && return || test -e '.git' && echo 'git' && return || cd .. && _upsearch
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
}
65:f9947eb0c34a Use upsearch for detecting if pwd is tracked
Anton Shestakov <engored@ya.ru>
previous changes: 57:c40d524fc90c
line | diff
54
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
function _set_hg_info {
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
if [[ $USE_HG_PROMPT ]] ; then
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local PROMPT_TEMPLATE="${P}{branch|quiet}{${Rd}{closed}}${P}☿{rev}{${B}+{tags|quiet|+}}{${Gd}*{bookmark}}{${R}{update}}{${G}+{rev|merge}}${R}{status|modified}${RESET}"
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
HG_INFO=" $(hg prompt $PROMPT_TEMPLATE)"
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
else
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local SUM=$(LC_ALL=C hg sum 2>/dev/null)
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local PARENTS=($(grep -Po '(?<=parent: ).*(?=:)' <<< "$SUM"))
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local BRANCH=$(grep -Po '(?<=branch: ).*$' <<< "$SUM")
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local COMMIT=$(grep -Po '(?<=commit: ).*$' <<< "$SUM")
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local UPDATE=$(grep -Po '(?<=update: ).*$' <<< "$SUM")
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local REV=${PARENTS[0]}
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local MERGEREV=${PARENTS[1]}
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
BRANCH=${BRANCH/default/}
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
[ -z "$MERGEREV" ] || MERGEREV="+$MERGEREV"
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
case "$COMMIT" in
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
*'(clean)'*)
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
COMMIT=''
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
;;
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
*added*|*modified*|*deleted*)
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
COMMIT='!'
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
;;
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
esac
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
case "$UPDATE" in
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
*'(update)'*)
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
UPDATE='^'
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
;;
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
*'(merge)'*)
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
UPDATE=''
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
;;
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
*'(current)'*)
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
UPDATE=''
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
;;
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
esac
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
HG_INFO=" ${P}${BRANCH}${REV}${R}${UPDATE}${G}${MERGEREV}${R}${COMMIT}${RESET}"
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
fi
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
}
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
function _set_git_info {
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local STATUS=$(LC_ALL=C git status 2>/dev/null)
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local BRANCH=$(grep -Po '(?<=On branch ).*$' <<< "$STATUS")
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local REV=$(LC_ALL=C git rev-parse --short HEAD 2>/dev/null)
68
68:c90c3504fbb3 git prompt: show merges (without conflict)
Anton Shestakov <engored@ya.ru>
previous changes: 66:584e8e0b08ee
line | diff
local MERGEREV=$(LC_ALL=C git rev-parse --short MERGE_HEAD 2>/dev/null)
66
66:584e8e0b08ee git prompt: mark non-empty stash
Anton Shestakov <engored@ya.ru>
previous changes: 65:f9947eb0c34a
line | diff
local STASH=$(LC_ALL=C git stash list 2>/dev/null)
54
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
if [[ $STATUS == *'Your branch is behind'* ]] ; then
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local BEHIND="$R^"
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
[[ $STATUS =~ behind[^$'\n']+([0-9]+)' 'commit ]] && BEHIND+=${BASH_REMATCH[1]}
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
fi
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
if [[ $STATUS == *'Your branch is ahead'* ]] ; then
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local AHEAD="$Y^"
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
[[ $STATUS =~ ahead[^$'\n']+([0-9]+)' 'commit ]] && AHEAD+=${BASH_REMATCH[1]}
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
fi
57
57:c40d524fc90c Color detached differently.
Anton Shestakov <engored@ya.ru>
previous changes: 54:065779098328
line | diff
if [[ $STATUS == *detached* ]] ; then
57:c40d524fc90c Color detached differently.
Anton Shestakov <engored@ya.ru>
previous changes: 54:065779098328
line | diff
REV="$P$REV"
57:c40d524fc90c Color detached differently.
Anton Shestakov <engored@ya.ru>
previous changes: 54:065779098328
line | diff
else
57:c40d524fc90c Color detached differently.
Anton Shestakov <engored@ya.ru>
previous changes: 54:065779098328
line | diff
REV="$G$REV"
57:c40d524fc90c Color detached differently.
Anton Shestakov <engored@ya.ru>
previous changes: 54:065779098328
line | diff
fi
54
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
if [[ $STATUS == *'Changes to be committed'* ]] ; then
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local STAGED="$R!"
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
fi
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
if [[ $STATUS == *'Changes not staged'* ]] ; then
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
local UNSTAGED="$P?"
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
fi
69
69:3e6ac54990dd git prompt: show merges with conflicts
Anton Shestakov <engored@ya.ru>
previous changes: 68:c90c3504fbb3
line | diff
if [[ $STATUS == *'You have unmerged paths.'* ]] ; then
69:3e6ac54990dd git prompt: show merges with conflicts
Anton Shestakov <engored@ya.ru>
previous changes: 68:c90c3504fbb3
line | diff
local MERGE="$R+$MERGEREV"
69:3e6ac54990dd git prompt: show merges with conflicts
Anton Shestakov <engored@ya.ru>
previous changes: 68:c90c3504fbb3
line | diff
fi
68
68:c90c3504fbb3 git prompt: show merges (without conflict)
Anton Shestakov <engored@ya.ru>
previous changes: 66:584e8e0b08ee
line | diff
if [[ $STATUS == *'All conflicts fixed but you are still merging.'* ]] ; then
68:c90c3504fbb3 git prompt: show merges (without conflict)
Anton Shestakov <engored@ya.ru>
previous changes: 66:584e8e0b08ee
line | diff
local MERGE="$B+$MERGEREV"
68:c90c3504fbb3 git prompt: show merges (without conflict)
Anton Shestakov <engored@ya.ru>
previous changes: 66:584e8e0b08ee
line | diff
fi
66
66:584e8e0b08ee git prompt: mark non-empty stash
Anton Shestakov <engored@ya.ru>
previous changes: 65:f9947eb0c34a
line | diff
if [[ ! -z $STASH ]] ; then
66:584e8e0b08ee git prompt: mark non-empty stash
Anton Shestakov <engored@ya.ru>
previous changes: 65:f9947eb0c34a
line | diff
STASH='S'
66:584e8e0b08ee git prompt: mark non-empty stash
Anton Shestakov <engored@ya.ru>
previous changes: 65:f9947eb0c34a
line | diff
fi
54
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
68
68:c90c3504fbb3 git prompt: show merges (without conflict)
Anton Shestakov <engored@ya.ru>
previous changes: 66:584e8e0b08ee
line | diff
GIT_INFO=" ${G}${BRANCH}±${REV}${MERGE}${BEHIND}${AHEAD}${STAGED}${UNSTAGED}${C}${STASH}${RESET}"
54
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
}
54:065779098328 Move hg and git info getting in procedures.
Anton Shestakov <engored@ya.ru>
previous changes: 45:a12c1aeefbfe
line | diff
44
44:a6137e70b11c Guess USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 42:34ee83bd5ad2
line | diff
# first find prompt in hgrc, then check it's actually enabled
44:a6137e70b11c Guess USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 42:34ee83bd5ad2
line | diff
if grep -w '^prompt' ~/.hgrc &>/dev/null && hg help prompt &>/dev/null ; then
44:a6137e70b11c Guess USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 42:34ee83bd5ad2
line | diff
USE_HG_PROMPT=1
44:a6137e70b11c Guess USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 42:34ee83bd5ad2
line | diff
fi
44:a6137e70b11c Guess USE_HG_PROMPT.
Anton Shestakov <engored@ya.ru>
previous changes: 42:34ee83bd5ad2
line | diff
35
35:44a6ddc7f222 Unlocal colors, lose double quotes where not needed.
Anton Shestakov <engored@ya.ru>
previous changes: 34:6d42e8d89e7e
line | diff
export VIRTUAL_ENV_DISABLE_PROMPT=1
0
0:226664158c55 Added .bashrc with hg prompt example.
Anton Shestakov <engored@ya.ru>
previous changes:
line | diff
export PROMPT_COMMAND=prompt_command