Storing Drupal Hierarchy in Subversion

Posted in |

Often it may prove desirable to push an entire Drupal hierarchy into subversion. The example only provides for local file access.

On Fedora 8 subversion is already installed. To check if installation already present.

rpm -q subversion

Login as root and create subversion root dir and children.

[root~]# mkdir /svndir
[root~]# mkdir -p /svndir/repos
[root~]# mkdir /svndir/users
[root~]# mkdir /svndir/permissions
[root~]# chown -fhR webmaster.apache svndir

Now create repository for our html dir.

[webmaster]# svnadmin create /svndir/repos/html

Do initial import of our html dir.

[webmaster]#svn import -m "initial import" /var/www/html file:///svndir/repos/html/trunk

Remove html dir.

[root~]# mv /var/www/html /var/www/html_pre_svn

Recreate html dir under version control. Mask is xrwx-rwx-r-x

[root~]#umask 0002
[root~]#svn checkout file:///svndir/repos/html/trunk /var/www/html

Subversion does not persist ownership or permissions. So we need to reset these. In particular we need to ensure that apache has +rw access to the domain files directory to permit file uploads.

[root~]#chown -R webmaster:webmaster /var/www/html
[root~]#chown -R webmaster:apache /var/www/html/sites/example.com/files

To commit changes to our entire Drupal hierarchy.

svn commit -m "changes made" /var/www/html
Submitted by Jonathan Mitchell on Sat, 05/30/2009 - 13:03

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
Let us know you are human.
1 + 4 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.