Development

#6708 (Automatically set property svn:ignore in generator tasks)

You must first sign up to be able to contribute.

Ticket #6708 (closed enhancement: wontfix)

Opened 8 months ago

Last modified 7 months ago

Automatically set property svn:ignore in generator tasks

Reported by: bschussek Assigned to: Jonathan.Wage
Priority: minor Milestone:
Component: sfDoctrinePlugin Version: 1.2.7
Keywords: Cc:
Qualification: Unreviewed

Description

The doctrine:build-* tasks all create a "base/" directory with generated content. Usually it is a bad practice to add generated files to the SVN repositorys (see the KDE Policy[1] for example), because the changes in generated files are completely irrelevant (they can be regenerated anyway).

I usually add all "base" directories in "form/doctrine", "filter/doctrine" and "model/doctrine" as well as in the generated plugin directories to svn:ignore. This is a very tedious task though that one can easily forget. Thus I suggest to introspect whether the symfony project is in an SVN working copy and, if yes, to automatically add these directories to svn:ignore.

You can easily find out whether a project is a working copy by verifying whether a ".svn" directory is available in the project root.

[1] http://techbase.kde.org/Policies/SVN_Commit_Policy#Don.27t_add_generated_files_to_the_repository

Change History

06/26/09 17:05:05 changed by mahono

as not all developers use SVN it would be better to send an event in the appropriate tasks and then a plugin could provide a listener doing that job

06/27/09 12:56:55 changed by bschussek

I agree with you. On the other hand, since a big bunch of the developers seems to be using it, I think this could be a useful feature. It would be activated only if your project is a SVN working copy anyway, so people without SVN are not affected.

07/07/09 01:01:23 changed by Jonathan.Wage

I disagree with this actually. I add generated files to SVN so that I can compare the generated files between revisions. Or if I upgrade symfony or Doctrine and I regenerate my models, I can then compare the differences in what Doctrine is generating now compared to the old version.

07/07/09 19:02:50 changed by bschussek

Jon: You're a Doctrine developer, so of course you always want to know what's going on behind the scenes ;-)

But seriously: The modified files should not ever change without the schema being changed (assuming Doctrine is included as external on a fixed revision); if they do, it is a bug in Doctrine. When the schema is changed, it is usually enough to review the schema for changes, so including the generated files should really not be necessary.

Upgrading between different versions of Doctrine is an entire different topic IMO. But since upgrading does happens only once or maybe twice in usual projects (if ever), this should not be a reason to include the generated files on every commit.

I agree with Matthias though, that the best solution would probably be to fire an event that is caught by a handler which does the svn:ignore thing.

07/08/09 00:03:48 changed by Russ

I see no reason not to commit your generated files.

When working with a team of developers and svn hooks that synchronise test servers etc. It is *more* tedious to have to make sure everyone rebuilds their model after updating, just in case someone has changed the schema or some other build-task related change.

I like to know that the copy I have generated on my machine is exactly the same as the one in svn (minus cache & log), and thus when checked out by someone else, or deployed to another server, will behave in exactly the same way, without relying on post-update tasks.

I also disagree about upgrading. I've worked on 2 large projects that have spanned almost a year each, and on the latter we actually switched to Doctrine 1.1 half way through, and tend to use the stable branch versions. The base files thus do tend to change.

Finally, when bug fixing errors in your schema, the exception traces often lead back to the base classes. Being able to compare these classes to earlier versions when things go wrong is invaluable, and trying to do so by searching through your schema declaration is time consuming and pointless when the base classes have all the answers.

My 2 cents :)

07/08/09 00:10:04 changed by Jonathan.Wage

That is another good point. You should never do a build or anything on your production server. The code should always come from svn and the upgrades should be applied via a patch.

07/08/09 09:52:26 changed by bschussek

Thank you both for your interesting input. You do have some valid points there.

Strangely I never had the need to compare the generated files between revisions. Instead, developers had to make many useless commits ("rebuilt the model") even if nothing else had changed (although it could be that this was before a tagged version of Doctrine was used in sfDoctrinePlugin). Furthermore, developers have to do build-all-reload anyway to get the database up to date.

Our current solution is a custom project:build task that does all this stuff for us and is simply launched everytime after updating the working copy.

Thank you both for the discussion. You can close this ticket if you want.

07/08/09 14:42:10 changed by Jonathan.Wage

  • status changed from new to closed.
  • resolution set to wontfix.

The first time rolling out to production you have to create the database, but then after that you don't do any builds or anything to production. Or at least that is what I do. I deploy changes via svn diff/patches and Doctrine migrations. Maybe we could create another ticket to add those events? So that you could implement this as a plugin for your own projects?

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.