|
Packit |
709fb3 |
#!/bin/sh
|
|
Packit |
709fb3 |
# List version-controlled file names.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# Print a version string.
|
|
Packit |
709fb3 |
scriptversion=2016-01-11.22; # UTC
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# Copyright (C) 2006-2017 Free Software Foundation, Inc.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# This program is free software: you can redistribute it and/or modify
|
|
Packit |
709fb3 |
# it under the terms of the GNU General Public License as published by
|
|
Packit |
709fb3 |
# the Free Software Foundation, either version 3 of the License, or
|
|
Packit |
709fb3 |
# (at your option) any later version.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# This program is distributed in the hope that it will be useful,
|
|
Packit |
709fb3 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
709fb3 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
709fb3 |
# GNU General Public License for more details.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# You should have received a copy of the GNU General Public License
|
|
Packit |
709fb3 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# List the specified version-controlled files.
|
|
Packit |
709fb3 |
# With no argument, list them all. With a single DIRECTORY argument,
|
|
Packit |
709fb3 |
# list the version-controlled files in that directory.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# If there's an argument, it must be a single, "."-relative directory name.
|
|
Packit |
709fb3 |
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
postprocess=
|
|
Packit |
709fb3 |
case $1 in
|
|
Packit |
709fb3 |
--help) cat <
|
|
Packit |
709fb3 |
Usage: $0 [-C SRCDIR] [DIR...]
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
Output a list of version-controlled files in DIR (default .), relative to
|
|
Packit |
709fb3 |
SRCDIR (default .). SRCDIR must be the top directory of a checkout.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
Options:
|
|
Packit |
709fb3 |
--help print this help, then exit
|
|
Packit |
709fb3 |
--version print version number, then exit
|
|
Packit |
709fb3 |
-C SRCDIR change directory to SRCDIR before generating list
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
Report bugs and patches to <bug-gnulib@gnu.org>.
|
|
Packit |
709fb3 |
EOF
|
|
Packit |
709fb3 |
exit ;;
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
--version)
|
|
Packit |
709fb3 |
year=`echo "$scriptversion" | sed 's/[^0-9].*//'`
|
|
Packit |
709fb3 |
cat <
|
|
Packit |
709fb3 |
vc-list-files $scriptversion
|
|
Packit |
709fb3 |
Copyright (C) $year Free Software Foundation, Inc,
|
|
Packit |
709fb3 |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
|
Packit |
709fb3 |
This is free software: you are free to change and redistribute it.
|
|
Packit |
709fb3 |
There is NO WARRANTY, to the extent permitted by law.
|
|
Packit |
709fb3 |
EOF
|
|
Packit |
709fb3 |
exit ;;
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
-C)
|
|
Packit |
709fb3 |
test "$2" = . || postprocess="| sed 's|^|$2/|'"
|
|
Packit |
709fb3 |
cd "$2" || exit 1
|
|
Packit |
709fb3 |
shift; shift ;;
|
|
Packit |
709fb3 |
esac
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
test $# = 0 && set .
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
for dir
|
|
Packit |
709fb3 |
do
|
|
Packit |
709fb3 |
if test -d .git; then
|
|
Packit |
709fb3 |
test "x$dir" = x. \
|
|
Packit |
709fb3 |
&& dir= sed_esc= \
|
|
Packit |
709fb3 |
|| { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
|
|
Packit |
709fb3 |
# Ignore git symlinks - either they point into the tree, in which case
|
|
Packit |
709fb3 |
# we don't need to visit the target twice, or they point somewhere
|
|
Packit |
709fb3 |
# else (often into a submodule), in which case the content does not
|
|
Packit |
709fb3 |
# belong to this package.
|
|
Packit |
709fb3 |
eval exec git ls-tree -r 'HEAD:"$dir"' \
|
|
Packit |
709fb3 |
\| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess
|
|
Packit |
709fb3 |
elif test -d .hg; then
|
|
Packit |
709fb3 |
eval exec hg locate '"$dir/*"' $postprocess
|
|
Packit |
709fb3 |
elif test -d .bzr; then
|
|
Packit |
709fb3 |
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
|
Packit |
709fb3 |
eval exec bzr ls -R --versioned '"$dir"' $postprocess
|
|
Packit |
709fb3 |
elif test -d CVS; then
|
|
Packit |
709fb3 |
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
|
Packit |
709fb3 |
if test -x build-aux/cvsu; then
|
|
Packit |
709fb3 |
eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
|
|
Packit |
709fb3 |
elif (cvsu --help) >/dev/null 2>&1; then
|
|
Packit |
709fb3 |
eval cvsu --find --types=AFGM '"$dir"' $postprocess
|
|
Packit |
709fb3 |
else
|
|
Packit |
709fb3 |
eval awk -F/ \''{ \
|
|
Packit |
709fb3 |
if (!$1 && $3 !~ /^-/) { \
|
|
Packit |
709fb3 |
f=FILENAME; \
|
|
Packit |
709fb3 |
if (f ~ /CVS\/Entries$/) \
|
|
Packit |
709fb3 |
f = substr(f, 1, length(f)-11); \
|
|
Packit |
709fb3 |
print f $2; \
|
|
Packit |
709fb3 |
}}'\'' \
|
|
Packit |
709fb3 |
`find "$dir" -name Entries -print` /dev/null' $postprocess
|
|
Packit |
709fb3 |
fi
|
|
Packit |
709fb3 |
elif test -d .svn; then
|
|
Packit |
709fb3 |
eval exec svn list -R '"$dir"' $postprocess
|
|
Packit |
709fb3 |
else
|
|
Packit |
709fb3 |
echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
|
|
Packit |
709fb3 |
exit 1
|
|
Packit |
709fb3 |
fi
|
|
Packit |
709fb3 |
done
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# Local variables:
|
|
Packit |
709fb3 |
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
|
Packit |
709fb3 |
# time-stamp-start: "scriptversion="
|
|
Packit |
709fb3 |
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
Packit |
709fb3 |
# time-stamp-time-zone: "UTC0"
|
|
Packit |
709fb3 |
# time-stamp-end: "; # UTC"
|
|
Packit |
709fb3 |
# End:
|