1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#-------------------------------------------------------------------------
# get_fossil_data()
#
# If the current directory is part of a fossil checkout, then populate
# a series of global variables based on the current state of that
# checkout. Variables are populated based on the output of the [fossil info]
# command.
#
# If the current directory is not part of a fossil checkout, set global
# variable $fossil_info_project_name to an empty string and return.
#
function get_fossil_data() {
fossil_info_project_name=""
eval `get_fossil_data2`
}
function get_fossil_data2() {
fossil info 2> /dev/null | sed 's/"//g'|grep "^[^ ]*:" | while read LINE ; do
local field=`echo $LINE | sed 's/:.*$//' | sed 's/-/_/'`
local value=`echo $LINE | sed 's/^[^ ]*: *//'`
echo fossil_info_${field}=\"${value}\"
done
}
#-------------------------------------------------------------------------
# set_prompt()
#
# Set the PS1 variable. If the current directory is part of a fossil
# checkout then the prompt contains information relating to the state
# of the checkout.
#
# Otherwise, if the current directory is not part of a fossil checkout, it
# is set to a fairly standard bash prompt containing the host name, user
# name and current directory.
#
function set_prompt() {
get_fossil_data
if [ -n "$fossil_info_project_name" ] ; then
project=$fossil_info_project_name
checkout=`echo $fossil_info_checkout | sed 's/^\(........\).*/\1/'`
date=`echo $fossil_info_checkout | sed 's/^[^ ]* *..//' | sed 's/:[^:]*$//'`
tags=$fossil_info_tags
local_root=`echo $fossil_info_local_root | sed 's/\/$//'`
local=`pwd | sed "s*${local_root}**" | sed "s/^$/\//"`
|
|
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#-------------------------------------------------------------------------
# get_fossil_data()
#
# If the current directory is part of a fossil checkout, then populate
# a series of global variables based on the current state of that
# checkout. Variables are populated based on the output of the [fossil info]
# command.
#
# If the current directory is not part of a fossil checkout, set global
# variable $fossil_info_project_name to an empty string and return.
#
function get_fossil_data() {
fossil_info_project_name=""
eval `get_fossil_data2`
}
function get_fossil_data2() {
fossil info 2> /dev/null | sed 's/"//g'|grep "^[^ ]*:" | while read LINE ; do
local field=`echo $LINE | sed 's/:.*$//' | sed 's/-/_/'`
local value=`echo $LINE | sed 's/^[^ ]*: *//'`
echo fossil_info_${field}=\"${value}\"
done
}
#-------------------------------------------------------------------------
# set_prompt()
#
# Set the PS1 variable. If the current directory is part of a fossil
# checkout then the prompt contains information relating to the state
# of the checkout.
#
# Otherwise, if the current directory is not part of a fossil checkout, it
# is set to a fairly standard bash prompt containing the host name, user
# name and current directory.
#
function set_prompt() {
get_fossil_data
if [ -n "$fossil_info_project_name" ] ; then
project=$fossil_info_project_name
checkout=`echo $fossil_info_checkout | sed 's/^\(........\).*/\1/'`
date=`echo $fossil_info_checkout | sed 's/^[^ ]* *..//' | sed 's/:[^:]*$//'`
tags=$fossil_info_tags
local_root=`echo $fossil_info_local_root | sed 's/\/$//'`
local=`pwd | sed "s*${local_root}**" | sed "s/^$/\//"`
|