Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN atomic commit how-to

Where I am: Linux command line

The problem I have now:

Sometimes I couldn't make atomic commits (consisting all the modifications required for one particular ticket/task), because we have some files in the repository, which contents vary at local development environments.

For example: database.xml (dbname, username, password, etc.). I modify this file in my local environment, and every time I need to make a commit/checkin I have manually list all the required files/folders for the commit (excluding this locally modified files).

Maybe it is a wrong design decision and database.xml has to be deleted from the repository and changed for database.xml.template (stored in SVN), so this file won't be included to commit until you manually execute svn add for it? Maybe it is wrong approach - to store all this environment dependent information in the repository - in that case we can break everything by commiting a modified configuration, for example..

As I understand it, svn:ignore property couldn't help in this situation, because it can be used only for files which isn't stored in the repository..

How can this problem be solved?

P.S.: I'm using Ubuntu and mostly pure command line for SVN.

like image 988
Nikita Fedyashev Avatar asked May 03 '09 10:05

Nikita Fedyashev


1 Answers

The "standard" procedure for this is something like this (forgiving the SVN syntax, I've been using Bazaar lately):

echo config > database.xml.template
svn add database.xml.template
svn ignore database.xml
svn commit

Then on each person's development machine:

svn checkout
cp database.xml.template database.xml
...edit database.xml...

And when they commit,

echo foo > someotherfile
svn commit

the database.xml file won't be added to Subversion.

like image 59
FryGuy Avatar answered Oct 14 '22 10:10

FryGuy