Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN for Delphi Developers

I have posted a question before, Moving away from VSS, in which I asked about the best VCS control for Delphi developers who were using VSS. Most developers seem to use svn with TortoiseSVN. I tried this for few days and I think it's the best route to go with.

However, I still have some confusion about the way that svn works so here are a few questions that I'd like answered:

  1. Can I work with old lock way(checkout-modify-checkin) that vss uses?

  2. Delphi forms have two files (MyForm.pas, MyForm.dfm). When I add any control to the form, both files will be modified so I want to commit "myform.pas" and have "myform.dfm" commit with it too. Am I missing anything here?

  3. The same applies for the Delphi Project file. Because this links with other files, all of them should be committed when I change the project file.

  4. What files do you have marked to be ignored in TSVN, so TSVN will not look for these files like (.dcu,.exe, ...), and can I export it from one Pc to other?

I now have to change the way I'm thinking in vss style, and need to change it for SVN style, but with vss, all things were managed within the IDE, which was fantastic ;-).

UPDATE:

5.If I commit the Delphi form(.pas & dfm) and found some one already updated the version before, how do you resolve the conflict if there some new controls and events added to that form and unit(this require Delphi developer with svn).

like image 922
Mohammed Nasman Avatar asked Jan 28 '09 10:01

Mohammed Nasman


4 Answers

  1. Yes, you could still lock files, but it's not recommended. You have to set the svn:needs-lock property on all the files you might want to lock so they get the readonly flag set when you check out. But again, that's not the recommended work flow for text files. Just give the modify-merge work flow a try!
  2. Since you're using TortoiseSVN: right-click on your parent folder, choose "Commit". In the commit dialog, you will see all files that need committing. Just check both the myform.pas and the myform.dfm file for the commit. All checked files will get committed together, no need (and definitely not recommended!) to commit each file individually!
  3. See 2. - But you should read the wonderful Subversion book first to get familiar with the concept. You should always commit all files that belong to a logical change. For example, if you add new controls to your form and implement the code to handle it, you may have more than just the form files modified but several files more. Always commit all those files together since a commit is a logical entity.
  4. You don't have to 'export' ignore settings. Just add the svn:ignored property. That's very easy to do with TortoiseSVN as explained in the docs.
like image 141
Stefan Avatar answered Oct 18 '22 22:10

Stefan


Re 5.: You should try it out. To limit the conflict potential it is a very good idea for the active developer to commit often, and for all others to update often from the SVN. Setting up email commit notifications can help a lot, so that all people know when to update. But having said that - you will find that the simple act of deleting a control and all its event handlers, or adding a control and a few handlers will not lead to conflicts that you need to resolve manually.

Edit: This answer by DiGi states that Delphi modifies the DFM even when the user did not. This is not true IMO, as a simple change in the timestamp of the DFM does not qualify as a local modification of the DFM file, and SVN will not commit a new revision. One has however to be careful to not move the forms in the Delphi IDE, as this will change the Top and / or Left properties of the form. Similarly changing the active page of a page control would count as a local modification. Before committing it is therefore a good idea to examine all local modifications, and revert all those that are merely accidental.

Edit 2: As onnodb pointed out in his comment there seem to be properties of the form that are indeed modified automatically, at least with Delphi 2007 (and probably later?). This would underline the importance of checking all local modifications before committing.

like image 32
mghie Avatar answered Oct 18 '22 23:10

mghie


Also see How do I start with working Sub-Version + Delphi? for some SVN tools which also integrate into the Delphi IDE.

like image 4
Lars Truijens Avatar answered Oct 18 '22 21:10

Lars Truijens


  1. Yes.

  2. TortoiseSVN automatically marks all modified files under version control when you commit.

  3. See 2.

  4. It's very easy to create an ignore list. Just right click a file and you get an option to ignore all files of that file type.

If you're using Visual Studio, you can use Ankh SVN for IDE integration.

like image 1
drby Avatar answered Oct 18 '22 22:10

drby