I have put my drupal stuff under subversion for some source control so I can unify the source of three separate installations. In theory I could use drupal's virtual hosting features and have a single set of drupal files but:
- I want these installations to have seperate files and images directories and drupals virtual hosting does not support this
- I want apache2 to control all my virtual hosting.
- I want my own drupal hacks under source control
Some notes on how I did this:
-
Create temporary copies of files I want submitted to subversion:
mkdir ~/drupal mkdir ~/drupal/trunk cp -r /var/www/petersblog.org/* /var/www/petersblog.org/.htaccess ~/drupal/trunk
-
remove stuff I don't want shared with other drupal installations:
rm -r ~/drupal/trunk/files rm -r ~/drupal/trunk/images rm -r ~/drupal/trunk/sites rm -r ~/drupal/trunk/favicon.ico
-
Put into subversion:
svn import ~/drupal file:///repository_name/drupal -m "First Import"
-
Get out of subversion again:
mkdir /var/www/petersblog2.org cd /var/www/petersblog2.org svn checkout file:///repository_name/trunk/drupal .
-
Since that worked ok, the copies of the files I created to put into subversion can now be zapped:
rm -r ~/drupalIf there is one thing I do not like about subversion it is this 'trunk' directory thing. I know it is not a requirement but just a convention but still. -
restore non-archived files
cp -r /var/www/petersblog.org/files /var/www/petersblog2.org/files cp -r /var/www/petersblog.org/images /var/www/petersblog2.org/images cp -r /var/www/petersblog.org/sites /var/www/petersblog2.org/sites cp -r /var/www/petersblog.org/favicon.ico /var/www/petersblog2.org
-
set up subversion to ignore these files that I don't want under svn control. After this running
svn statuswill not list these files and subversion will not attempt to add them to the archive:svn propedit svn:ignore . files images sites favicon.ico
-
commit changes, namely the changes to the svn:ignore properties
svn commit -m "Ignore files I do not want shared" -
make sure my new copy has everything:
diff -r --exclude=.svn /var/www/petersblog.org /var/www/petersblog2.org
-
change to the new site archive
cd .. mv petersblog.org petersblog_presvn.org mv petersblog2.org petersblog.org
-
list anything that has changed:
cd /var/www/petersblog.org svn status
-
Get the code out on a new site:
mkdir /var/www/newsite cd /var/www/newsite svn checkout file:///repository_name/trunk/drupal .
-
After modifying the archive, get latest code out of subversion:
svn update
-
Put changes to code into subversion:
svn commit -m "did some hacking"
this cheat sheet was useful.


Hey Peter, saw your post on planet drupal. Wanted to comment to you about svn's trunk folder, because you wrote: "If there is one thing I do not like about subversion it is this 'trunk' directory thing."
I would have done the following:
> mkdir ~/proj
> cp -r /var/www/petersblog.org ~/proj/trunk
> svn import ~/proj file:///repository_name/petersblog -m "First Import"
Then when you need to checkout:
> svn checkout file:///repository_name/petersblog/trunk drupal
So your working directory is called 'drupal' and contains the same files as in your instructions. But in your repository the root directory is called trunk, not trunk/drupal. Later when your project gets complicated you may create branches/drupal-branch-1 or whatever. In svn the branches and tags should be named, but the trunk is simply the trunk. And branches, tags and trunks are all in one directory named after the general project (petersblog in this case).
That's my understanding, anyway. I have a setup similar to yours.