about summary refs log tree commit diff
path: root/scripts/list-sources.sh
blob: 41c8b9eaddb4ece2d908edf89b6b0d6389fffdb9 (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
#!/bin/sh
#
# List all the files under version control in the source tree.
#

case $# in
0) ;;
1) cd "$1" ;;
*) echo >&2 "Usage: $0 [top_srcdir]"; exit 2 ;;
esac

if [ -r CVS/Entries ]; then

  ${CVS:-cvs} status 2>&1 | ${AWK:-awk} '
NF >= 2 && $(NF - 1) == "Examining" { dir = $NF }
$1 == "File:" { print (dir == ".") ? $2 : (dir "/" $2) }'
  exit $?

elif [ -r .svn/entries ]; then

  ${SVN:-svn} ls -R | sed '/\/$/d'
  exit $?

elif [ -r MT/options ]; then

  exec ${MONOTONE:-monotone} list known

elif [ -r .git/HEAD ]; then

  exec ${GIT:-git} ls-files

fi

echo >&2 'Cannot list sources without some version control system in use.'
exit 1