[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Auto add files in a directory?

From: Robert Guthrie <rguthrie_at_pobox.com>
Date: 2004-03-05 22:52:41 CET

Reviving an old thread, this is what I am planning for the /etc
directories on my Debian Linux systems....

Andrew A. Raines wrote:
> I'd like to add ~/Mail to my svn-controlled homedir. However, due
> to the transient nature of files with Gnus' nnml, I don't want to
> have to manually add and remove new and old messages.
> Can I configure a directory to be ``hands-off'' and let Subversion
> do the Right Thing upon commit, adding and removing files as
> necessary to match the WC? IOW, can svn be told ``for this
> directory, make the repository match exactly the way it sees the WC
> at the start of this commit?''

My solution to this kind of thing is working out like this for my
machine, locally named "ripley", my soon-to-be firewall:

1. Create a new directory:
svn mkdir user@$URLtoMYsvnREP/trunk/ripley/etc

2. As root on ripley:
cd /
svn checkout user@$URLtoMYsvnREP/trunk/ripley/etc

Now, my /etc directory has a .svn dir, but no files are checked in.

3. Run this command (as root) to check things in:
svn status | egrep "^\?" | sed -e 's/? *//' | xargs svn add

4. Create a script, which either ends up in a cron job, which uses the
above command in /etc plus this one to take care of deletes:

svn status | egrep "^\!" | sed -e 's/! *//' | xargs svn rm

The only difference being that I'm looking for exclamation marks &
issuing an "rm" instead of "add".

Then the script will need to check the changes back in, to avoid
problems with apt-get trying to remove/rename files and directories that
  I added. Perhaps the script is run every time dpkg, dselect, and
apt-get are run, as a wrapper to those commands. Maybe.

######## WARNING #######
This method has not been tested except in a trivial case, and there are
some things I still haven't worked out, like what svn does with symbolic
links (ignore, tries to check in, dereferences...). I'll probably just
use find to populate a file with a list of symlinks and other special
files, and then exclude them from the list of files processed by xargs.
  Plus, that'll give a good idea of what links need to be added should I
have to restore a previous revisino of /etc.

Does anybody see any problems with this setup, assuming I do the right
thing(tm) with regards to special files and commit / file & dir
modification timing?

P.S. I haven't delved into the idea of a client-side perl/python script 
that uses svn API calls to do this kind of thing... that would probably 
be better, but my way will at least get me started.
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Mar 5 22:53:14 2004

This is an archived mail posted to the Subversion Users mailing list.