- In this lesson you will learn the following concepts
- SCM (Source Code Manager)
- Principle of SCM
- Creating the repository
- Checking a project into the SCM
- Add project to the SCM
- Opening a project from the SCM
- Configuring the SCM
- Handling the project via SCM
- Modifying a project parameter
- Modifying a project window
- Checking the checked-out element back in
- Synchronizing the project
- Offline mode
- SCM administrator
- Disconnecting from the SCM
In this lesson you will learn the following concepts
- The Source Code Manager.
- Using the Source Code Manager.
Estimated time: 30 mn
|The Source Code Manager is not available in the Express version.|
The development of a large IS system requires the participation of multiple developers. These developers must work on a single WINDEV project and share different resources (windows, classes, etc.).
WINDEV offers a Source Code Manager (SCM) used to share the source codes of different projects between developers and get the full history of changes in the code, interface, etc.
SCM (Source Code Manager)
Principle of SCM
The Source Code Manager is used to store and share projects and their elements.
The principle is as follows:
- A reference version of each one of your projects is found on a server. This set of versions is called "Repository".
- Each developer has a local copy of the different projects.
- When a developer wants to modify a project element (window, report, query, etc.), they notify the SCM that they temporary own this element. To do so, the developer will check out the element from the repository.
- This developer gets exclusive rights on this element: all the desired modifications can be performed on this element.
- The other developers are still working on the copy of the reference version of this element (found in the repository).
- Once the developer has finished, the checked out element is checked back into the repository.
- The other developers are automatically notified of this check-in operation. They can now update their local copy.
The SCM supports teamwork and allows you to get the history of all the changes. The SCM can also be used to manage and control the elements shared between several projects.
|You can also share source elements through GitHub. |
The environment allows saving projects, windows, pages, reports, classes, sets of procedures and code in a Git repository. For more details, see Share your projects via Git.
However, it is recommended to use the SCM. In addition to text comparison, the SCM allows for rich object comparison (control properties, for example). An SCM-specific interface allows you to easily merge and compare differences between elements.
Creating the repository
To share a project via the Source Code Manager, a repository must be created. This repository must be created once only on a server.
This repository can be created:
- when installing WINDEV.
- when creating a project that uses the SCM.
- when importing a project into the SCM.
- whenever you want, from WINDEV directly or from the SCM administrator.
The repository can be installed in the following modes:
- HFSQL Classic,
- HFSQL Client/Server,
- PCSCloud (paid turnkey solution). The PCSCloud mode allows you to access the sources of the projects from anywhere, at any time. This mode corresponds to a private Cloud (dedicated server) and offers numerous options (dedicated platform, Control Centers, etc). For more details, see PCSCloud.
- SCMDrive (paid turnkey solution). The SCMDrive mode allows you to access the sources of the projects from anywhere, at any time. This solution uses a shared server. For more details, see SCMDrive.
- Our repository will be created when a project is imported into the SCM (next step).
|We advise you to make backup copies of the repository on a regular basis. To do so, you must: |
- connect to the SCM management tool as administrator.
- on the "Management" pane, in the "Backups" group, select "Full backup".
Checking a project into the SCM
Add project to the SCM
To use an existing project with the Source Code Manager, simply include it in the repository. We will add our "WD Full Application" project.
- Open the project you worked on in the previous lesson.
- Go to the WINDEV home page (Ctrl + <).
- On the home page, click "Tutorial", then in "Part 4 - Full application with data", double-click "Full application (Exercise)".
- A dialogue box prompts you to open the project you worked on in the previous lesson. You can open the local copy or the original project. Select "Open the local copy".
|A corrected project is available. This project allows you to perform the different operations in this lesson. To open the corrected project, go to the home page and click "Tutorial", then in "Part 4 - Full application with data", double-click "Full application (Answers)".|
- We are now going to include the "WD Full Application.WDP" project in the repository:
- On the "SCM" pane, in the "Add project" group, click "Add project to SCM". The wizard for adding projects to the SCM appears:
The repository has not been created yet. We are going to create one.
Remark: To makes things easier, we will create a local HFSQL Classic repository on the development computer. The operation would be similar for another type of repository.
|If the repository is in HFSQL Client/Server format, it can be used remotely.|
- Click "Local database".
- The repository creation window appears.
- Specify the repository directory (e.g., "C:\My Projects\SCM Local repository).
- Validate the creation of the repository ("Create repository").
- The repository has now been created. It is automatically selected in the wizard. We are going to include our project in this repository.
- Go to the next step.
- The wizard proposes to locate the project in the "WINDEV projects" subdirectory of the repository.
Accept this location. Go to the next step.
- The wizard asks you to select the project elements that will be added to the repository.
We want to add all project elements. Go to the next step.
- The wizard asks you to select the project dependencies that will be added to the repository. These dependencies correspond to all external elements required by the project (images, style sheets, etc.).
We want to add all project dependencies. Go to the next step.
- Validate the project integration in the SCM. The project and its elements have been added to the repository.
|Sharing project elements|
When the projects that share the same resources (same analysis, same windows, etc.) are included in the SCM, the relevant elements can be shared between the different projects. Therefore, the same element is checked in only once and the modifications are automatically applied to the other projects.
Opening a project from the SCM
In our example, the project is checked into the SCM and can be used directly.
In a real case, in order for other developers to work on a project found in the Source Code Manager, they must get a copy of this project locally.
To do so, the following operations must be performed:
- Open the project from the Source Code Manager: on the "Home" pane, in the "General" group, expand "Open" and select "Open a project from the SCM".
- Specify the location parameters of the repository and validate (this step is required only if the current project in the editor does not belong to the SCM):
- In the screen that is displayed, specify (if necessary) the connection and the local directory:
: If the project was already opened from the SCM, the SCM proposes to open the project as usual or to overwrite the content (to retrieve the entire project). This operation must be performed only once by each developer using the project. The developer who added the project to the Source Code Manager (you in this case) has no operations to perform.
|Next time, you will be able to open a project included in the SCM as any other project: all you have to do is open the project (".WDP" file) corresponding to the local copy.|
Configuring the SCM
Before you start working on the elements of the project included in the SCM, you must configure the mode for checking out the project elements.
When working on the elements of a project in the SCM, the element must be checked out from the repository before it can be modified, then it must be checked back in once the changes have been made. Therefore, the modified element becomes available to all SCM users.
WINDEV proposes two modes for checking out the project elements:
- the standard mode: if you display an SCM element that is not checked out, a panel indicates that the element must be checked out before it can be modified. The element can be checked out immediately (check-out button found in the dialog box).
- the automatic mode: if you try to modify an SCM element that is not checked out, the SCM automatically proposes to check it out. Once the check-out is validated, the element can be modified.
Remark: this mode is not recommended when using the SCM with a slow Internet connection.
The automatic check-out will be used in this tutorial.
- To make sure the automatic check-out is enabled, go to the "Home" pane, "Environment" group, expand "Options" and select "General options of WINDEV". On the "General" tab, in the "Source Code Manager (SCM)" section, select "Check out elements during the first modification".
Handling the project via SCM
We will work with the SCM in real conditions by performing the following operations:
- Modify a project parameter.
- Modify a project window.
Modifying a project parameter
- We are going to modify the project by asking to display the skin template on the system windows:
- Open the project description: on the "Project" pane, in the "Project" group, click "Description".
- Click the "Style" tab.
- Check "Customize the system windows (Info, YesNo, Confirm, Dialog)".
- Validate the project description window.
- Several SCM windows appear:
- First of all, the window for automatic project check-out is displayed. Indeed, we want to modify a project characteristic therefore the project must be checked out.
- The "Check in the project automatically at the end of the operation" option checks the project in once all changes have been made. Keep this option.
- Validate this window.
- Different check-in and check-out windows open allowing you to add the internal component "WDFAA.wci" and its elements to the project in the repository and extract them to the local project. This component contains the different system windows to customize. Validate these different windows.
- The project description window is closed and the project is automatically checked back into the repository.
Modifying a project window
We are now going to modify the "WIN_Product_form" window: a click on the image must allow to modify the image (like the "Modify" button).
A checked-out element (UI, code, etc.) can be modified as any other element of a project not included in the SCM.
However, the modifications performed on a checked out element are not visible to the other developers.
If another developer runs the checked out element, the element that is currently found in the repository will be used.
This allows you to make an application evolve while keeping a stable version in the repository.
- Test your modifications.
- Test the project (click in the quick access buttons).
- Select a product and click "Modify".
- In the form that is displayed, click the product image: the file picker is opened to modify the product image. This is the expected operating mode.
- Close the test window.
Checking the checked-out element back in
Now that the modifications have been made and tested, we are going to check the window back into the repository. Then, your modifications will be made accessible to the other developers.
- On the "SCM" pane, in the "Current element" group, click "Check in". The following window is displayed:
This window is used to:
- find out the modifications made by comparing the element from the repository with the checked out element ("My Modif...").
You can compare an element with one of its earlier versions. This allows you to compare the code in order to retrieve a code section that was "lost" or accidentally deleted by another developer.
- access the history of the element in the repository ("Properties...").
- type a comment about the modifications performed. By default, WINDEV proposes the comment typed during the check-out.
- send a message to the other developers.
- check in the modifications made to the element while keeping the element checked out ("Keep element checked out").
|If you are using the Control Centers, the current task can be ended when the element is checked back into the Source Code Manager. This feature is useful to monitor tasks, fix bugs, etc.|
- Validate the check-in. The window is displayed in the editor.
Synchronizing the project
Multiple options can be used to configure a project handled by the SCM. These options are grouped in the "SCM" tab of the project description (to open it, click "Description" on the "Project" pane).
These options are as follows:
- Propose to get the latest version of the elements when the project is opened.
When opening a project found in the SCM, this option proposes to get the latest version of the project elements.
- Propose to check in the elements when the project is closed.
When the project is closed, this option is used to display the list of elements that are currently checked out in order for some of them (or all of them) to be checked back in.
By default, when the project is closed, the checked out elements are not checked back in.
- Check out/Check in the project automatically.
This option allows you to automatically check out or check in the project when using an element.
This option is selected by default.
The SCM allows you to work in offline mode. This mode allows a developer (who uses a laptop, for example) to continue working on a project found in the repository while being offline.
The principle is simple:
- before the disconnection, go to the "SCM" pane, "Other actions" group, expand "Remote work" and select "Disconnect to work offline".
- on reconnection, on the "SCM" pane, in the "Other actions" group, expand "Remote work" and select "Reconnect and synchronize". Then, simply check the modified elements back in.
In offline mode, there are two solutions to check out elements:
- No element is checked out from the SCM. The other developers will be able to work on the same elements as you while you are working in offline mode. When you reconnect to the SCM, the changes you made on the element must be merged with the changes made by other developers.
- The elements that you want to modify are checked out in exclusive mode. No one else can use the element while you are working in offline mode.
The SCM administrator is used to directly handle the different projects included in the source code manager.
It allows you to:
- manage repositories (create or connect to a repository).
- manage files and directories in a project of the repository (add, delete, rename, ... files and directories).
- manage the different files of the repository (check-out, check-in, share, etc.).
- start some tools (options, maintenance, etc.).
- view the history of an element.
- view the status of the elements.
- perform backups.
- grant rights to the different SCM users.
- list the projects in which you are taking part in order to dissociate from them (if necessary).
- Start the SCM administrator: on the "SCM" pane, in the "Repository" group, click "Manage". All project elements are listed in the administrator.
Disconnecting from the SCM
In the rest of this tutorial, we will use the "WD Full Application". To simplify the operations, it is recommended to disconnect from the SCM:
- Open the project description window: on the "Project" pane, in the "Project" group, click "Description".
- In the "SCM" tab, select "No developer groupware and no SCM".
- Validate the project description window.
We have presented the main steps for developing an application.
WINDEV proposes several tools to optimize your applications. For more details, see "Project audits"