--- a/.bash_prompt Thu Aug 28 21:01:58 2014 +0900
+++ b/.bash_prompt Fri Aug 29 02:51:26 2014 +0900
+function prompt_command {
+ local Rd="\[\e[0;31m\]"; local R="\[\e[0;91m\]"; local Rb="\[\e[1;31m\]"
+ local Gd="\[\e[0;32m\]"; local G="\[\e[0;92m\]"; local Gb="\[\e[1;32m\]"
+ local Yd="\[\e[0;33m\]"; local Y="\[\e[0;93m\]"; local Yb="\[\e[1;33m\]"
+ local Bd="\[\e[0;34m\]"; local B="\[\e[0;94m\]"; local Bb="\[\e[1;34m\]"
+ local Pd="\[\e[0;35m\]"; local P="\[\e[0;95m\]"; local Pb="\[\e[1;35m\]"
+ local Cd="\[\e[0;36m\]"; local C="\[\e[0;96m\]"; local Cb="\[\e[1;36m\]"
+ if [[ $TERM == 'linux' ]] ; then
+ local RESET="\[\e[0m\]"
+ local TIME="${G}\t${RESET}"
-function prompt_command {
+ if [[ $RETURN_CODE != 0 ]] ; then
+ local RETCODE="${R}${RETURN_CODE}${RESET} "
if [[ $EUID == 0 ]] ; then
TEST_DIR=$(dirname "$TEST_DIR")
- if [[ $HG_TRACKED ]] ; then
+ if [[ $HG_TRACKED && $USE_HG_PROMPT ]] ; then
+ local PROMPT_TEMPLATE="${P}{branch|quiet}{${Rd}{closed}}${P}☿{rev}{${B}+{tags|quiet|+}}{${Gd}*{bookmark}}{${R}{update}}{${G}+{rev|merge}}${R}{status|modified}${RESET}"
+ local HG_INFO=" $(hg prompt $PROMPT_TEMPLATE)"
+ if [[ $HG_TRACKED && ! $USE_HG_PROMPT ]] ; then
local SUM=$(LC_ALL=C hg sum 2>/dev/null)
local PARENTS=($(grep -Po '(?<=parent: ).*(?=:)' <<< "$SUM"))
local BRANCH=$(grep -Po '(?<=branch: ).*$' <<< "$SUM")
local GIT_BRANCH=$(grep -Po '(?<=On branch ).*$' <<< "$GIT_STATUS")
local GIT_REV=$(LC_ALL=C git rev-parse --short HEAD 2>/dev/null)
- if [[ $GIT_STATUS == *'Your branch is behind'* ]]; then
+ if [[ $GIT_STATUS == *'Your branch is behind'* ]] ; then
[[ $GIT_STATUS =~ behind[^$'\n']+([0-9]+)' 'commit ]] && GIT_BEHIND+=${BASH_REMATCH[1]}
- if [[ $GIT_STATUS == *'Your branch is ahead'* ]]; then
+ if [[ $GIT_STATUS == *'Your branch is ahead'* ]] ; then
[[ $GIT_STATUS =~ ahead[^$'\n']+([0-9]+)' 'commit ]] && GIT_AHEAD+=${BASH_REMATCH[1]}
- if [[ $GIT_STATUS == *'Changes to be committed'* ]]; then
+ if [[ $GIT_STATUS == *'Changes to be committed'* ]] ; then
- if [[ $GIT_STATUS == *'Changes not staged'* ]]; then
+ if [[ $GIT_STATUS == *'Changes not staged'* ]] ; then
local VENV="${G}+"$(basename "$VIRTUAL_ENV")"${RESET}"
- if [[ $RETURN_CODE != 0 ]] ; then
- local RETCODE="${R}${RETURN_CODE}${RESET} "
${RETCODE}\W${VENV}${HG_INFO}${GIT_INFO}${BOLD}]\