|
|
|
|
|
- Sharing your source code with the SCM
- Introduction
- How the SCM works
- The repository
- Importing an existing project into the SCM
- Opening a project from the SCM
- Manipulating the project via SCM
- Changing a project feature
- Modifying a project page
- Checking the checked-out element back in
- Further information
- Conclusion
Tutorial - An SCM for WEBDEV
Sharing your source code with the SCM We will cover the following topics: - What is the Source Code Manager?
- Characteristics of the repository.
- Practical example: using the Source Code Manager:
- Adding a project to the Source Code Manager.
- Editing elements.
![Durée de la leçon Durée de la leçon](https://doc.windev.com/en-US/images/image.awp?langid=3&name=dur%E9e.png&0) 30 min The development of a large IS system requires the participation of multiple developers. Sometimes, developers must work on a single WEBDEV project and share different resources (pages, classes, etc.). WEBDEV includes a Source Code Manager (SCM) that allows developers to share the source code of different projects and find the full history of changes made to the code, interface, etc. The Source Code Manager is used to store and share projects and their elements. The principle is as follows: - A reference version of each of your projects is stored on a server. This set of versions is called "Repository".
- Each developer has a local copy of the different projects.
- When developers want to make changes to an element of a project (page, report, query, etc.), they indicate to the SCM that they temporarily 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 continue to work on the copy of the reference version of the element (located 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 manages teamwork and allows you to get the history of all the changes. It can also be used to manage and control elements shared between multiple projects. ![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) SCM or GitHub? 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 elements. To share a project via the Source Code Manager, you must create a repository. This repository must be created only once on the server. When should the repository be created? The repository can be created at different times: - when installing WEBDEV.
- when importing a project into the SCM.
- whenever you want, from WEBDEV directly or from the SCM administrator.
What are the different types of repositories? The repository can be created in one of the following modes: - HFSQL Classic,
- HFSQL Client/Server,
![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) If the repository is in HFSQL Client/Server format, it can be used remotely. - 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.
In the rest of this tutorial, we will create our repository when importing a project into the SCM. Importing an existing project into the SCM To use an existing project with the Source Code Manager, simply add it to the repository. We will add the "Full_WEBDEV_Site" project. ![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) To make things easier, we will import the project into a new local HFSQL Classic repository on the development computer. The operation would be similar for another type of repository. Opening the example project This tutorial uses the "Full WEBDEV Site" project. To open this example: - Go to the WEBDEV home page (Ctrl + <).
- On the home page, click "Tutorial", then in "Tutorial - Create a WEBDEV website (Back Office and Front Office)", double-click "Full WEBDEV Site - Answers".
Creating the repository and importing the project Let's import the project into an SCM repository: - On the "SCM" tab, 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.
![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) We will create a "Client/Server" repository on the server we installed in Managing an HFSQL Client/Server database. If you haven't followed this tutorial, you will need to complete the lesson on how to install the HFSQL server. - Click "HFSQL Client/Server".
![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) If the repository is in HFSQL Client/Server format, it can be used remotely. - The HFSQL Client/Server repository creation window opens.
- Specify the parameters of the HFSQL server installed previously:
- The server name and its port.
- The name and password of the administrator.
- Validate the new repository (click "Create repository"). This operation can take quite a long time in Client/Server mode.
- The repository has now been created. We will add our project to this repository.
- Go to the next step. The current user is not allowed to access the HFSQL server.
We are going to create this user: enter the required information and click "Create account".
- The wizard prompts you to save the project in the "Projects" subdirectory of the repository.
Accept this location. Go to the next step.
- Select the project elements that will be added to the repository.
Add all project elements. Click "All" and 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.).
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.
![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) Sharing project elements When projects with shared resources (analysis, pages, etc.) are added to the SCM, these resources can also be shared with other projects present in the SCM. Therefore, the shared element is checked in only once and the changes made to that element 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 located in the Source Code Manager, they must get a copy of this project locally. To do so, follow these steps: - Open the project from the Source Code Manager: on the "Home" tab, in the "General" group, expand "Open" and select "Open a project from the SCM".
- In the "HFSQL C/S" tab, enter the repository location parameters and validate (this step is necessary only if the current project is not included in the SCM):
- In the window that appears, indicate the connection and local directory if necessary:
Remark: If you have already opened the project from the SCM, it prompts you 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 who uses the project. The developer who added the project to the Source Code Manager (you in this case) has no operations to perform. ![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) Next time, you will be able to open a project imported into the SCM as any other project: simply open the local copy of the project. Manipulating the project via SCM We will work with the SCM in real conditions by performing the following operations: - Change a project feature.
- Modify a project page.
Changing a project feature We will apply a skin to the dialog boxes of the project: - Open the project description: on the "Project" tab, in the "Project" group, click "Description".
- Click on the "Skin" tab.
- Check "Apply the skin to the dialog boxes (YesNo and OKCancel)".
- Validate the project description window.
Several SCM windows appear: - First, the automatic project check-out window is displayed. To change a project feature, it must be checked out.
![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) By default, the SCM uses an automatic check-out mode: if you try to modify an element that has not yet been checked out, the SCM automatically prompts you to check it out. WEBDEV offers several check-out modes. For more details, see Project management modes. - 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 a page template and a series of internal pages to the repository and extract them to the local project. Validate these different windows.
- The project description window is closed and the project is automatically checked back into the repository.
Modifying a project page Let's now modify the "PAGE_Product_form" page. We will move the "OK" button. To modify a project element, it must be checked out. ![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) A checked-out element (UI, code, etc.) can be modified as any other element of a project that is not included in the SCM. However, the other developers cannot see the changes made to the element. If other developers need to work on the checked-out element, they will use the one in the repository. This allows you to make an application evolve while keeping a stable version in the repository. To modify the "PAGE_Product_form" page: - Select "PAGE_Product_form" in the "Project explorer" pane and double-click on it to open it in the page editor.
- Automatic check-out is enabled when the first change is made: simply move a control to check out the element. You can also click "Check out" in the ribbon of the SCM tab (
). - The check-out window opens:
- The SCM shows three check-out modes:
- Exclusive (recommended mode): nobody can check out this element until it is checked back in. The element can be checked out for tests only.
- For tests: the element can be modified but the modifications will not be checked back in.
- Multiple: the element can also be checked out by other users. In this case, the differences between the different element versions can be viewed when the element is checked back in. This mode is reserved to specific cases and to experienced developers.
- Check out the page in exclusive mode. Keep the "Exclusive" option checked.
- Write a comment ("Button position updated", for example). This comment will be useful for the other developers.
- Confirm the check-out.
The page is checked out. - Select the "OK" button.
- Move the button to the right (below the download control).
- Save the page (Ctrl + S).
Test your changes. - Open "PAGE_List_of_products".
- Test the page (click
in the quick access buttons). - Click the "Edit" link of one of the products.
- The page with the product details opens. The "OK" button is displayed at the new position.
- Close the browser.
Checking the checked-out element back in Now that the changes have been made, we are going to check the page back into the repository. The other developers will be able to access your changes. On the "SCM" tab, in the "Current element" group, click "Check in". The following window appears:
This window is used to: - view the changes made by comparing the element from the repository with the checked out element ("My changes" button).
![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) Merging code 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" button).
- write a comment about the changes made. By default, WEBDEV shows the comment written when the element was checked out.
- send a message to the other developers.
- check in the changes made while keeping the element checked out ("Keep element checked out" option).
![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) 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 window. In this tutorial, we have learned how to create, add and manipulate a project in an SCM repository. The SCM offers many other options and features: ![](https://doc.windev.com/ext/images/us/note_v2.png?478445243) We advise you to make backup copies of the repository on a regular basis. These backups can be made via the SCM administrator. To learn more about the SCM, see The Source Code Manager. We will use the "Full WEBDEV Site" project again in the following tutorials. To follow these steps more easily, it is recommended to disconnect from the SCM: - Open the project description window: on the "Project" tab, in the "Project" group, click "Description".
- In the "SCM" tab, select "No SCM or external manager (Git)".
- Validate the project description window.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|