1

We're trying to update an installed software which we have under control by subversion. The update instructions for the software require replacing several directories that have .svn directories in them.

Since we cannot replace these directories outright, I've been trying to come up with a way to replace the contents of these directories (and recursively the contents of all subdirectories), but not the directories themselves. I think there has to be a solution using some combination of flags for cp, but I cannot figure out what that combination is.

I looked at using cp -aR directory/ existing_directory/, but I cannot use -a because timestamps are not to be trusted for updates. I have no problem replacing all the files. Additionally, I don't believe the trailing slash will be carried through subdirectories recursively.

I would be grateful if someone could steer me in the proper direction. Thanks!

1 Answer 1

4

This sounds messy. Subversion gets all upset when you delete .svn directories.

The way I would do it is to create a copy, remove all the .svn directories from the copy, run the upgrade on the copy and then use rsync to copy all those changes from the copy to the original.

The sequence should look something like this:

cp -R software/ software-copy/
cd software-copy/
find . -type d -name .svn -delete
./upgrade-script.sh
cd ..
rsync -avtl software-copy/ software/

You can add -n in to those rsync options if you want to do a dry run and see what would be copied over without actually doing it.

1
  • That sounds like a reasonable enough solution. Thanks! Mar 12, 2012 at 13:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .