views:

1865

answers:

8

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).

+1  A: 
  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.

drby
+10  A: 
  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.
Stefan
Stefan thanks so much for all your work on TortoiseSVN!
Warren P
+5  A: 

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.

mghie
At least Delphi 2007 *does* tend to modify the DFM file even if you didn't modify anything on the form. It usually updates some auto-generated properties (forgot which ones) if you open the form and make some changes to the source code. By looking at the diff, you can easily spot this, though.
onnodb
@onnodb: :-( Interesting, I did not know about that one. It would be interesting to know what they are.
mghie
Delphi 2006 has the same problem. It mainly seems to toggle the ItemHeight property of TComboBox from 0 to 16 and back. I have even found that going into the form designer and moving the combobox up then down 1 pixel will toggle it back.
Gerry
Thank you mghie, your answer was helpful too, but I can't accept more than one answer :(
Mohammed Nasman
@Mohammed Nasman: I agree completely, the answer by Stefan is the most helpful as it answers most of your questions.
mghie
+4  A: 

Also see http://stackoverflow.com/questions/370518/how-do-i-start-with-working-sub-version-delphi for some SVN tools which also integrate into the Delphi IDE.

Lars Truijens
I had heard that Delphi 2010 was supposed to eventually get built-in Subversion check in/check-out support but since your files are only partly visible within the IDE, it's better to use an Explorer style ("file manager") view such as that given by external SVN tools, TortoiseSVN or some other client.
Warren P
+1  A: 

Developers can use CommitMonitor to receive information about new commits.

ad 5: It is bad if two or more developers are using same .dfm. Simple modifications can work (merge) fine. it is important to commit only if you are really made difference in files. Delphi usually modify .dfm even you don't change anything.

DiGi
A: 

You could us SourceConexion. It integratesin the Delphi IDE. It supports locking of files so that you don't end up in trouble with the DFM files.

I use TortoiseSVN when working with C# but in Delpi I find it good to be using SC since I ended up with corrupt DFM files after more then one developer had done changes in them..

Richard L
I doubt that DFM files were corrupt. Most probably you had an unresolved conflict, and in this state the DFM is of course unusable. But reverting to the version in the repository should always work.
mghie
Yes, of course. but that takes time to resolve.
Richard L
+1  A: 

I usually use this little python script before updating from SVN, in order to clean my source tree.

I store the .dof files in SVN so I need to commit manually any .dof change before cleaning the source tree.

import os
import sys

exts = ['.~pas', '.~dpk', '.~bpl','.dcu', '.~dcu', '.dcp', '.~dcp',
        '.dof', '.cfg', '.res', '.~res']

def mydir():
    if __name__ == '__main__':
     filename = sys.argv[0]
    else:
     filename = __file__
    return os.path.abspath(os.path.dirname(filename))


def clean_dir(arg, dirname, names):
    for name in names:
      if os.path.splitext(name)[1].lower() in exts:
        file2delete = os.path.join(dirname,name)
        print os.path.join(file2delete)
        os.remove(file2delete)


if __name__=="__main__":
  print "Cleaning Tree"
  os.path.walk(mydir(), clean_dir, "a")
Pierre-Jean Coudert
A: 

DFM files do not change on their own, for me.

I'm not sure what other people are doing to their dfm files, or what settings in Delphi might cause this. I have no problems. Only the dfm files I change are listed (as changed) in the Commit dialog. I am using Delphi 2007 and Delphi 7.

Rich J