views:

942

answers:

8

Our Delphi 7 development team stores form files (dfm) in text mode, and uses a source control system (Subversion) to track changes.

Sometimes, we noticed that a form file returned to binary format between revisions, causing diff tools like TortoiseMerge to complain.

Using the Subversion change log, I can see that the DFM file was stored in text form before. The software developers never change the storage file format back to binary manually.

Have you encountered the same? Is it a known problem?

+1  A: 

If someone has opened the project with different version of Delphi (or changed the default settings), he may save the forms in different format.

Francis
Good hint, I will check this. We have also Delphi 2007 and 2009 installed. The default settings are only for new forms, so I am not sure how they can affect existing forms.
mjustin
+2  A: 

No, I've never seen (or heard of) this happening on it's own before. We have hundreds of .DFMs in a couple of dozen apps, and this has only happened when some idiot accidentally right-clicks on a form and unchecks 'Text DFM' on the context menu.

Ken White
Maybe it was the infamous 'right click and uncheck text dfm' virus? ;)
mjustin
Nah... Our AV software would have caught that. It was an idiot. <g>
Ken White
Is it Delphi 7?
mjustin
We have a mix of Delphi 7 and 2007 (I'm the only one who's moved fully to 2009).
Ken White
+2  A: 

I have seen it happen in Delphi 7 when a form inheriting from another form from a different project was opened in Delphi on its own without the project it belongs to being open.

Lars Truijens
A: 

We've certainly encountered this. We use D7 exclusively.

Never got to the bottom of it as it happens only half a dozen times a year or so, and although it's a nuisance it's fairly easily remedied.

I was interested to see Lars's answer, and will certainly look to see if that's a possible cause next time it happens.

RichardS
+1  A: 

You may be interested in investigating the use of Beyond Compare instead of TortoiseSVN's built-in merge tool. Beyond Compare is written in Delphi, and natively knows how to read binary DFMs. This means that it then becomes less of an issue (or even no issue) whether your DFMs are stored in Subversion in binary or text. Beyond Compare V3 also does 3-way merging which makes it really easy to merge multiple commits etc. Even ignoring the ability to diff binary DFMs, it's still a much better diff viewer than TortoiseSVN's built-in tools. I can highly recommend it, and it's very inexpensive (I have no connection with Scooter Software, other than being a very happy customer).

Scooter Software

Conor Boyd
+2  A: 

This sometimes happens when the IDE gets confused.

It usually starts after you got an access violation inside the Delphi 7 IDE.

Sometimes also one or mor of your Delphi editor buffers inside the IDE become readonly (while the files on disk are still read/write).

The behaviour occurs much less than in Delphi 5 or 6, but sometimes it does occur in Delphi 7.

The best thing you can do is restart the Delphi 7 IDE as soon as you get an access violation.

Jeroen Pluimers
A: 

We also have this issue from time to time, and it seems to be related to looking at the DFM's source (Alt-F12) and then doing a Visual Source Safe operation (e.g. check-in).

marius
+2  A: 

This does happen in Delphi 7 but is fixed in later versions. Usually you access forms in the IDE by opening the .pas file and then switching to the Form View. Right click your form and it will show that it is "Text DFM" ticked if you have done this before.

You will experience the problem you have described of a text DFM switching to a binary DFM when in the Delphi 7 IDE you open the .dfm file directly. eg. File->Open->Somefile.dfm .. Right click the dfm and choose "View as Form". Now right click the form, you will see that the "Text DFM" is unticked.

We were getting the problem when we opened up a DFM which was a grep search result. It had us perplexed also, and would cause corruption of the dfm in cvs as it was checked in as text.

Jared Davison