打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Delphi XE and Subversion Integration

Delphi XE and Subversion Integration
Subversion by CollabNet is a standard for version control and Software Configuration Management (SCM).Subversion is now integrated into the RAD Studio XE IDE, so anyone with Delphi XE can use Subversion features directly.
However, before we can use Subversion from the IDE, we should first create a repository to store the files.This can be done in two ways: either a local repository (for your own projects), or a remote repository, where multiple developers can connect to.

Local Repository
Since I do not expect all Delphi XE developers to start their own remote SVN repositories, I will start with creating a local repository first.For this, I抦 using TortoiseSVN, which you can download from http://tortoisesvn.tigris.org/ offering a Subversion client implemented as a Windows shell extension (so we can create repositories using Windows Explorer for example).
Once TortoiseSVN is installed, you can create a new directory on your local drive (in a location where you want to save the repositories ? not the actual project files), and inside that directory use Windows Explorer to set up your repository.As an example, I抳e created a directory C:\Repositories on my local machine, right-clicked in it, and selected the TortoiseSVN | Create repository here option.

This will give you dialog that the repository has been created successfully, and will show a number of administration files in that directory.You should no longer manually add or remove files from this directory now.

The next step we need to do is obtain the URL for this local repository.Right-click again, and this time select the Repo-browser.

The repository will still be empty, but at least we can see the repository URL, which is file:///C:/RepositoriesWe can now start Delphi XE, and use the repository URL to add an existing project to the local SVN repository.As an example, I can add my Matrix project to the local repository.So, while the project is opened, right-click on the project node in the Project Manager and select 揂dd to Version Control?.
In the dialog that follows, we need to specify the URL of the Repository.This is the URL we saw earlier in the repo-browser, followed by a name for the specific project.This name does not have to be the name of the Delphi project, but it must be some kind of subdirectory name that can be used.In our case, I can save the Matrix project in the repository URL file:///C:/Repositories/MatrixProject for example.

We then need to click in Import to actually add the file to the local repository.In the Subversion tab of the messages pane, you will see the files that have been added and sent to the local repository.
From this moment on, we can use the Subversion context menu of the project or individual files of the project to Commit (send local changes to the repository), Update (get the latest version from the local repository) and Browse Repository (to get an overview of the files in the local repository).
Unfortunately, there are no options to Lock or Unlock a file, which can be done using Checkout (lock) and Checkin (unlock).This feature request was added to Quality Central as QC report #87736 (feel free to vote!), and can be read in more detail on my weblog.Note that the Lock and Unlock functionality are especially important when working with remote repositories.

Remote Repository
To setup a remote SVN repository, we need some kind of SVN server, for which I抳e used the free Standard Edition of VisualSVN Server 2.1.3 that you can download from http://www.visualsvn.com/server/ for free.The installer includes both Apache 2.2.13 and Subversion 1.6.12, so you must be careful (for port conflicts) if you already have IIS on your web server, which I do on my old Windows Server 2003 machine.

I抳e installed both the VisualSVN Server and the Management Console, which gives me all the options I need to manage the SVN repositories on the server.

As location for the repositories I抳e specified c:\Repositories ? a location not shared or used by other applications.As port I had to specify a different port than the default port 443 (since that one was in use by IIS already), so I picked port 8443 to use https://
The only problem is that I had to use a so-called self-signed certificate, which means people will get a warning when they try to connect to my Delphi SVN repositories at https://www.bobswart.nl:8443/

Finally, I did not want to use Windows authentication, but rather use Subversion authentication, which means I can define users, groups and repositories with rights for these users and groups.
Given a group 揇elphi? and two users 揃ob? and 揅ourseware?, I can define some SVN repositories, including one called 揦E? with the project group and source files for the individual projects of my Delphi XE Development Essentials courseware manual.

The readers of the Delphi XE Development Essentials courseware manual will get the credentials for the Courseware user, which is able to read but not write to the material (that is only offered to user Bob).

With the projects in place, let抯 now demonstrate how to open an example project from the XE repository.But first, I should demonstrate how to add a project to the repository, and especially how to add a complete project group.In this case, the project group with the AQtime project and the ProfileProject all at once.
Inside the Project Manager, I had to right-click on the Project Group itself, and select the Add to Version Control option.This may give you a warning if not all files are located in the same root directory, in which case you must make sure to save the file to the right place first.
When you get all files in the list of files to be committed, then you can specify the URL of the repository.For a local repository, this could be a file:/// URL, but now we have to use a 搑eal? URL which is based at https://www.bobswart.nl:8443/ on my server.For the XE repository, we need to add the svn and XE part to it, and then we also need to add the name of the project or project group to ensure that these files end up in their own place in the XE repository.
In short, the full URL of the repository is https://www.bobswart.nl:8443/svn/XE/7 for the project group of this section.
We can optionally add an Import Comment, which I抳e set to 揟hese are the source files for the section on Delphi XE Third-Party Tools of Bob Swart's Delphi XE Development Essentials courseware manual.?

Then, I only need to click on the Import button to send all files over to the XE repository.However, we now get a dialog where the Subversion SSL Server certificate information is shown, including a question if we want to accept it:

This dialog is followed by the Subversion login dialog.Here, I can specify my username and password to get read/write access to the project, while you (the reader) later need to specify the information to get read-only access to the projects in this repository.

Finally, I will get the message to tell me the import was successful, and the local files (i.e.the working copy) are now locked.

Let抯 now move to another machine, and open the repository (as a reader).On a different machine, I can start Delphi XE and do File | Open from Version Control.The dialog that follows can be used to specify the SVN URL as well as the local destination:

Unfortunately, there is no way to specify the credentials, so I抳e had to ensure on the SVN server that 揈veryone? has at least read-only access to the repositories.
When all files are downloaded and added to the local destination directory, we get a question which project to open from the project group, or the project group itself.

The default choice is to open the entire project group, which is fine of course.This will open the project group with the two projects.
We can now right-click on the nodes in the Project Manager and select the Subversion options, like Commit (from the local directory to the server ? not allowed, since we only have read-only access), Update (to get updates from the server), Show Log (to show the actions as well as any comments that were added, like the 揟hese are the source files for the section on Delphi XE Third-Party Tools of Bob Swart's Delphi XE Development Essentials courseware manual.? comment), Clean, and Browse Repository (where we can see the files in the connected repository:

Note that you cannot save changes to my repository, since you can only read the files (and not write them).But you can open the projects from the repository, save them on your local disk and work with them.And whenever I post updates to these projects, you can retrieve the updates.

Other SVN Projects
Note that the Delphi XE sample projects themselves are also available on SVN. Project samples (previously called Demos) are installed by both the Delphi XE and the C++Builder XE installer.The samples are also checked into Subversion at SourceForge.You can check this location for additions or updates to the samples.
Finally, the Open Tools API integration of SVN in Delphi XE itself is also available in SourceForge.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
pwlazy的专栏
CollabNet Subversion Server 配置 - 我是金色,我是闪光! -...
win7下安装svn服务器端及客户端详细步骤
Centos+Nginx搭建SVN服务器
用 Subversion 构建版本控制环境
TortoiseSVN?的使用
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服