annotate llvm/utils/GetSourceVersion @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 #!/bin/sh
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 usage() {
anatofuz
parents:
diff changeset
4 echo "usage: $0 <source root>"
anatofuz
parents:
diff changeset
5 echo " Prints the source control revision of the given source directory,"
anatofuz
parents:
diff changeset
6 echo " the exact format of the revision string depends on the source "
anatofuz
parents:
diff changeset
7 echo " control system. If the source control system isn't known, the output"
anatofuz
parents:
diff changeset
8 echo " is empty and the exit code is 1."
anatofuz
parents:
diff changeset
9 exit 1
anatofuz
parents:
diff changeset
10 }
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 if [ $# != 1 ] || [ ! -d $1 ]; then
anatofuz
parents:
diff changeset
13 usage;
anatofuz
parents:
diff changeset
14 fi
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 cd $1
anatofuz
parents:
diff changeset
17 if [ -d .svn ]; then
anatofuz
parents:
diff changeset
18 svnversion | sed -e "s#\([0-9]*\)[A-Z]*#\1#"
anatofuz
parents:
diff changeset
19 elif [ -f .git/svn/.metadata ]; then
anatofuz
parents:
diff changeset
20 git svn info | grep 'Revision:' | cut -d: -f2-
anatofuz
parents:
diff changeset
21 elif [ -d .git ]; then
anatofuz
parents:
diff changeset
22 git log -1 --pretty=format:%H
anatofuz
parents:
diff changeset
23 else
anatofuz
parents:
diff changeset
24 exit 1;
anatofuz
parents:
diff changeset
25 fi
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 exit 0