[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-patch] [PATCH] Addition of --rm-command to specify the remove c
From: |
Andreas Gruenbacher |
Subject: |
Re: [bug-patch] [PATCH] Addition of --rm-command to specify the remove command |
Date: |
Sat, 20 Jun 2009 18:09:19 +0200 |
User-agent: |
KMail/1.10.3 (Linux/2.6.30-rc6-git3-4-pae; KDE/4.1.3; i686; ; ) |
On Saturday 20 June 2009 00:44:25 Daniel Gutson wrote:
> Hi,
> the attached patch adds the --rm-command command line option, used to
> specify a different 'rm' command, useful to use in source directories
> controlled by revision control systems (such as svn).
Patch has very limited support for a small number of version control systems
-- it can check out missing files before applying a patch to them. I think
the historic purpose was to allow applying patches without having to check out
the entire source repository. I don't think this is an important use case
anymore. None of the other version control operations are covered (like
deleting files).
The feature is there and we cannot drop it anymore, but I would like to avoid
adding further nonsense: there are lots of subtle differences among version
control systems, and even different ways to use the same version control
system. Generalizing all these operations would result in several complex
hooks, and I don't think this is a useful approach.
Instead, let me suggest a wrapper. Here is an example which may help:
#! /bin/sh
tmpdir=$(mktemp -d .${0##*/}.XXXXXX)
trap "rm -rf $tmpdir" 0
patch "$@" --backup -B $tmpdir/
IFS='
'
for backup in $(find $tmpdir/ -type f); do
file=${backup#$tmpdir/}
if test -s "$backup"; then
if test -e "$file"; then
echo "M $file"
else
echo "D $file"
fi
else
echo "A $file"
fi
done
Thanks,
Andreas