blob: 9bd3058b9f413cfa4414f77e2e234fef51559cef (
plain) (
tree)
|
|
#!/bin/sh
# Read in library functions
if ! [ -r @LIB@/patchfns ]
then
echo "Cannot read library @LIB@/patchfns" >&2
exit 1
fi
. @LIB@/patchfns
usage()
{
echo "Usage: inpatch [patchname]"
echo " inpatch -f filename"
if [ x$1 = x-h ]
then
cat <<EOF
Print the list of files that the topmost or specified patch
changes.
-f Print which patches change the specified file.
EOF
exit 0
else
exit 1
fi
}
options=`getopt -o f:h -- "$@"`
if [ $? -ne 0 ]
then
usage
fi
eval set -- "$options"
while true
do
case "$1" in
-f)
opt_file=$2
shift 2 ;;
-h)
usage -h ;;
--)
shift
break ;;
esac
done
if [ $# -gt 1 ]
then
usage
fi
opt_patch=$1
scan_patches()
{
local patches=$* patch
for patch in $patches
do
refresh_file_list $patch
status=$?
if [ $status -eq 2 ]
then
if [ -z "$opt_quiet" ]
then
echo "Recreated file list for $patch" >&2
fi
elif [ $status -ne 0 ]
then
echo "Could not create file list for patch $patch" >&2
return 1
fi
done
grep -l -e "^$(quote_re $opt_file)\$" $(pc_file_name $patches) \
| sed -e 's:^\.pc/::' -e 's:/\.pc$::'
}
if [ -n "$opt_patch" ]
then
patch=$(stripit "$opt_patch")
else
patch=$(top_patch)
if [ -z "$patch" ]
then
echo "No patches applied" >&2
exit 1
fi
fi
if [ -z "$opt_file" ]
then
if ! is_applied $patch
then
if ! patch_in_series
then
echo "Patch $patch not in series file" >&2
else
echo "Patch is not applied (no old/new status)" >&2
no_status=1
fi
fi
for file in $(files_in_patch $patch)
do
if [ -n "$no_status" -o -s $(backup_file_name $patch $file) ]
then
echo "$file"
else
echo "$file (new)"
fi
done
else
#if [ -n "$opt_patch" ]
#then
# scan_patches $(patches_before $opt_patch) | sed -e 's/^/> /'
# scan_patches $opt_patch | sed -e 's/^/| /'
# scan_patches $(patches_after $opt_patch) | sed -e 's/^/< /'
#else
# series=$(cat_series)
# if [ -n "$series" ]
# then
# scan_patches $series | sed -e 's/^/< /'
# fi
#fi
series=$(cat_series)
if [ -n "$series" ]
then
scan_patches $series
#| sed -e 's/^'"$(quote_re $patch)"'$/\0 (here)/'
fi
fi
|