blob: 9a2f7c83da41d4c69389e585d5f386130d46f05a (
plain) (
tree)
|
|
##
# systr_repo_resolve_reference <symref> [<path>]
#
# Resolve a revision to a commit ID. This function is polymorphic
# for both local and remote repositories. The result is printed to
# stdout.
##
function systr_repo_resolve_reference
{
if [ $# -lt 1 ]; then
echo "Fatal: too few arguments to systr_repo_resolve_reference"
exit 1
fi
symref="$1"
if [ $# -gt 1 ]; then
path="$2"
fi
if [[ "$symref" == "BASE" ]]; then
cat ".systr/BASE"
elif [[ "$symref" == "TRAC" ]]; then
read trac <.systr/TRAC
systr_repo_resolve_reference "$trac"
elif [[ "$symref" == "NULL" ]]; then
echo "NULL"
fi
if [[ "$remote" == "" ]]; then
(
cd "$path"
if [[ "$symref" == "HEAD" ]]; then
cat "refs/HEAD"
elif [ -f "refs/$symref" ]; then
cat "refs/$symref"
elif [ -f "revs/$symref/.commit.systr" ]; then
echo "$symref"
else
echo "$symref not a revision"
exit 1
fi
)
else
ssh "$remote" "systrunk resv-ref \"$symref\" \"$path\""
fi
}
|