* lib/autoconf/general.m4 (AC_ARG_ENABLE): Print help about
[autoconf.git] / build-aux / vc-list-files
blob2fcc94734315a5c29ef83577ccea7673185dd3dc
1 #!/bin/sh
2 # List the specified version-controlled files.
4 # Copyright (C) 2006 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software Foundation,
18 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 # List the specified version-controlled files.
22 # With no argument, list them all.
23 # This script must be run solely from the top of a $srcdir build directory.
25 # If there's an argument, it must be a single, "."-relative directory name,
26 # with no trailing slashes. In mercurial mode, it's used as part of a
27 # "grep" pattern (prepend "^", append "/"), and in cvs mode, it's simply
28 # used as an argument to the cvsu script.
30 include_prefix=
31 case $# in
32 0) ;;
33 1) include_prefix=$1 ;;
34 *) echo "$0: too many arguments" 1>&2; exit 1 ;;
35 esac
37 if test -d .git; then
38 if test "x$include_prefix" = x; then
39 git-ls-files | cut -d ' ' -f 3
40 else
41 git-ls-files | cut -d ' ' -f 3 | grep "^$include_prefix/"
43 elif test -d .hg; then
44 if test "x$include_prefix" = x; then
45 hg manifest | cut -d ' ' -f 3
46 else
47 hg manifest | cut -d ' ' -f 3 | grep "^$include_prefix/"
49 elif test -x build-aux/cvsu; then
50 build-aux/cvsu --find --types=AFGM $include_prefix
51 else
52 awk -F/ '{ \
53 if (!$1 && $3 !~ /^-/) { \
54 f=FILENAME; \
55 sub(/CVS\/Entries/, "", f); \
56 print f $2; \
57 }}' \
58 $(find ${*-*} -name Entries -print) /dev/null;