Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically adding, deleting and committing files into a subversion repository using Delphi

Tags:

svn

delphi

I would like to programmatically check if a file is versioned, and add, delete and commit files into a subversion repository using Delphi.

Does anyone have sample code that might help me create the necessary functions and procedures?

Thanks,

Steve

like image 979
Steve Kramer Avatar asked Oct 28 '10 21:10

Steve Kramer


People also ask

How do I commit changes to svn repository?

Select any file and/or folders you want to commit, then TortoiseSVN → Commit.... The commit dialog will show you every changed file, including added, deleted and unversioned files. If you don't want a changed file to be committed, just uncheck that file.

How do I delete a file from a commit in svn?

To remove a file from a Subversion repository, change to the directory with its working copy and run the following command: svn delete file… Similarly, to remove a directory and all files that are in it, type: svn delete directory…

How do I commit all files in svn?

svn list <URL> Lists all the files available in the given URL in the repository without downloading a working copy. svn add <filename> Use this command to add new files or changed files to the commit list. svn commit m “Commit message” Commit the added files using a commit message for better traceability.


3 Answers

Delphi XE integration is open source (MPL based license). You can get the code at radstudioverins on SourceForge.

take a look at trunk/svn/SvnClient.pas, and let me know if it's what you're looking for. It is a nice looking wrapper around libsvn.

like image 180
jachguate Avatar answered Oct 30 '22 09:10

jachguate


Probably the easiest way to do this is to call the svn command line program, passing it the relevant commands and arguments to do whatever it is you want to do. Although there are probably Delphi-compatible Subversion API bindings, calling svn is undoubtedly going to be more straightforward.

Most svn command line commands have an --xml switch that writes the output in program-friendly XML format, instead of making you rely on fragile text parsing.

like image 25
Greg Hewgill Avatar answered Oct 30 '22 09:10

Greg Hewgill


The most recent version, Delphi XE has Subversion integration by default.

like image 1
Marco van de Voort Avatar answered Oct 30 '22 09:10

Marco van de Voort