Toby Johnson <toby@etjohnson.us> writes:
> We have a web site checked in to Subversion which includes some
> behind-the-scenes config files. When I make changes to this site, I
> first test those changes in a development directory.
>
> The development version of these config files point to a development
> MySQL database, but the production version of course points to the
> production database. So every time I want to commit changes from the
> development area, svn sees these config files as modified, but I don't
> want to check those changes in.
>
> Is there some clever way to get svn to not notice these changes in the
> development working copy? Currently I have to explicitly specify each
> file I want to commit so it doesn't pick up the unwanted changes as
> well. I guess I could write a shell script to temporarily swap out the
> config files if nothing else. Has an "exclude" option to "commit" or
> "status" ever been considered?
I have this situation too. Here is how I solved it in a pre-commit
hook:
#!/bin/sh
REPOS="$1"
TXN="$2"
### Make sure that the log message contains some text.
SVNLOOK=/usr/local/bin/svnlook
LOG=`$SVNLOOK log -t "$TXN" "$REPOS"`
echo "$LOG" | grep "[a-zA-Z0-9]" > /dev/null || exit 1
# Make sure we don't accidentally commit the live DB password.
if svnlook diff -t "${TXN}" "${REPOS}" \
| grep '^-$db_url = "mysql://mysite:PUTPASSWORDHERE_at_localhost/mysite";' \
> /dev/null; then
echo "You almost committed the live MySQL password." 1>&2
exit 1
fi
exit 0
You could do something similar. The above code prevents me from ever
committing the DB password from the live site's config files. But you
could just protect against modifying certain files at all, that might
be easier.
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Dec 13 20:59:30 2004