blob: dc0af377003df6922cbc2556051824fd84b2b6a9 (
plain) (
blame)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
##
# get_commit <version>
#
# Resolve a revision to a commit ID, exit via fatal error if
# resolution cannot take place.
##
function get_commit
{
# local repository #
if [[ "$remote" == "" ]]; then
if [[ "$1" == "HEAD" ]]; then
cat "$path/HEAD"
elif [[ "$1" == "BASE" ]]; then
cat ".systr/BASE"
elif [[ "$1" == "TRAC" ]]; then
read trac <.systr/TRAC
get_commit "$trac"
elif [[ "$1" == "NULL" ]]; then
echo "NULL"
elif [ -f "$path/refs/$1" ]; then
cat "$path/refs/$1"
elif [[ ${1:0:5} == "refs/" ]]; then
if [ -f "$path/$1" ]; then
cat "$path/$1"
fi
elif [ -f "$path/$1/.commit.systr" ]; then
echo "$1"
else
echo "Error: $1 not a revision" >&2
exit 1
fi
# remote repository #
else
exit 1
fi
}
##
# get_symref <version>
#
# Resolve a revision to a symbolic reference, exit via fatal
# error if resolution cannot take place.
##
function get_symref
{
# local repository #
if [[ "$remote" == "" ]]; then
if [[ "$1" == "HEAD" ]]; then
echo "HEAD"
elif [[ "$1" == "BASE" ]]; then
echo "BASE"
elif [[ "$1" == "TRAC" ]]; then
cat ".systr/TRAC"
elif [[ "$1" == "NULL" ]]; then
echo "NULL"
elif [ -f "$path/refs/$1" ]; then
echo "refs/$1"
elif [ -f "$path/$1/.commit.systr" ]; then
echo "$1"
else
echo "Error: $1 not a revision" >&2
exit 1
fi
# remote repository #
else
exit 1
fi
}
|