Rsync and recursion protection with .svn folders
matt at mattmccutchen.net
Thu Dec 18 04:13:55 GMT 2008
On Wed, 2008-12-17 at 09:02 -0800, Richard Lee wrote:
> src(local copy) --> dst(svn working copy)
> I want to sync changes over from src to dst, leaving the [.svn] folders intact
> on the dst, as long as the folder containg the [.svn] folder still exists in
> the source. i.e. If a folder is deleted from src I would like it to be
> deleted from dst, this implies that its .svn folder is deleted in dst.
> (Additions and changes are handled automatically by svn.)
> So what I did is a rsync fom src to dst with --exclude=".svn" --delete
> --force. However if I delete a folder say myfol from source which also
> exists in dst, I says that it cannot delete it. Obviously this is due to the
> fact that rsync recurses and finds and protects the .svn in myfol.
What you need is the "p" modifier to a protect rule, which makes it not
protect a destination file whose parent no longer exists on the source.
Use --filter='Pp .svn'. Copying to an svn working tree was actually a
major use case motivating the addition of the "p" modifier:
More information about the rsync