+# The third part of the prompt is taken from p4-completion.bashrc.
+# It is shown only if __ps1_p4 is 1. By default it is 0.
+#
+# The fourth part of the prompt is taken from svn-completion.bashrc.
+# It is shown only if __ps1_svn is 1. By default it is 0.
+#
+# The fifth part of the prompt is the exit status of the last command.
+# This part will be shown only if __ps1_user is set and the exit status is
+# non-zero.
+#
+# The final part of the prompt is the (full) working directory and $ string.
+#
+# Colouring is performed by the __ps1_col() and __ps1_ret() functions.
+# We redirect stderr to /dev/null when calling these functions to prevent
+# bash complaining about not knowing them when you su to another user,
+# retaining PS1 but not the function definitions.
+#
+# Note that $? is passed as an argument to - and is returned from - all
+# functions. As $? is set following any shell activity it is only guaranteed
+# to represent the return code of the last command at the beginning of __ps1().
+# By passing between subsequent functions we ensure that it is available for
+# __ps1_ret().
+#
+
+# Pick a colour based on the terminal capabilities.
+# OK: dark green.
+# Failed: dark red.
+# Git: royal blue.
+# P4: yellow.
+# SVN: magenta.
+case $(tput colors) in
+ 256)
+ PROMPT_OK_COLOUR="1;38;5;34"
+ PROMPT_FAILED_COLOUR="1;38;5;160"
+ GIT_COLOUR="0;38;5;33"
+ SVN_COLOUR="0;38;5;127"
+ P4_COLOUR="0;38;5;142"
+ ;;