User Tools

Site Tools


k11:k11.7:start

11.7 Project maintenance

Necessary changes to a project, such as extensions with additional classes, modules or forms that extend or change the range of functions or the internationalization through translations into other languages should be understood as project maintenance. As long as you are working alone on a project, you know the current project status. This changes when you work with other developers on one or more projects.

Initial situation: Two developers A and B work together on one project. Developer A has added several procedures to the project, modifying or deleting others. In order to inform developer B of the changes, developer A could send him the modified, possibly very extensive, project archive. Instead, developer A suggests that developer B only insert the changes in the project that are stored in a patch into his or her project version.

A patch is a text file *.patch in which the differences - known as deltas - between an alt. ext file and a new. ext file are stored in a specific format. A patch file created by the console program' diff' can also handle multiple files, so that a patch file can be used to update an entire folder structure to a new version. To create this type of patch file, use the -r (–recursive) switch to recursively compare all subdirectories. As a Gambas developer, you don't need to use either the' diff' program or the' patch' program - with which a patch is applied - in the console. The Gambas IDE has the entries in the menu:

Projekt> Patch> Create ...
Projekt> Patch> Apply ...

and uses the programs 'diff' and 'patch' via dialogs to create a patch as well as to apply a patch internally.

In the following excerpt from the contents of the patch file SpineCalcD-0.1.4~SpineCalcE-0.1.7.patch you can easily recognize the added (+) and deleted (-) contents by means of the simple leading plus and minus signs at the beginning of a line. The changes in the example affect the source code in the class.src/FMain. class as well as in the form.src/FMain. form in the compared projects SpineCalcD (version 0.1.4) and SpineCalcE (version 0.1.7):

diff -urNaX /tmp/gambas-patch-ignore a/notes/combobox.txt b/notes/combobox.txt
--- a/notes/combobox.txt	2017-12-18 17:43:32.000000000 +0100
+++ b/notes/combobox.txt	2017-12-18 17:44:11.000000000 +0100
@@ -1,9 +1,11 @@
…
diff -urNaX /tmp/gambas-patch-ignore a/.src/FMain.class b/.src/FMain.class
--- a/.src/FMain.class	2017-12-18 17:43:32.000000000 +0100
+++ b/.src/FMain.class	2017-12-18 17:44:11.000000000 +0100
@@ -1,28 +1,29 @@
 ' Gambas class file 
-  FMain.Caption = "Spine-Berechnungen für Pfeile"
+  FMain.Caption = "Spine Value Calculator for Arrows"
   FMain.Resizable = False
...
-Public Sub btnBerechnen_Click()
-  SpineBerechnen()

     Case 2
-      $iSehnenOffset = -5
+      $iBowStringOffset = -5
   End Select
   
-  If optMitKoecher.Value = True Then 
-     $iKoecherOffset = 5
... 
 Private Sub ClearResults()
-  txbSpineHolz.Clear()
+  txbSpineWood.Clear()
   txbSpineCarbon.Clear()   
 End
 
diff -urNaX /tmp/gambas-patch-ignore a/.src/FMain.form b/.src/FMain.form
--- a/.src/FMain.form	2017-12-18 17:43:32.000000000 +0100
+++ b/.src/FMain.form	2017-12-18 17:44:11.000000000 +0100
@@ -1,63 +1,62 @@
 # Gambas Form File 3.0
 { Form Form
-  MoveScaled(0,0,48,32)
+  MoveScaled(0,0,49,32)
   Icon = Picture["symbols/form_icon.png"]
...
-  { lblSpineHolz Label
+  { lblSpineWood Label
     MoveScaled(2,17,19,4)
-    Text = ("Spine-Wert (Holz):")
+    Text = ("Spine (Wood):")
   }
-  { txbSpineHolz TextBox
+  { txbSpineWood TextBox
     MoveScaled(22,17,18,4)
     Background = &HDFEFFF&
   }

11.7.1 Create Patch

After both developers successfully developed and tested the SpineCalcD project up to version 1.0.4, developer A names a copy of the SpineCalcD project in SpineCalcE and changes all relevant texts on the form and in the source code from German to English. He then creates a patch between version 0.1.4 and version 0.1.7 and sends the patch file SpineCalcD-0.1.4~SpineICalcE-0.1.7.patch to developer B.

Attention: The projects are renamed so that you can follow the creation and import of patch files on your computer.

Schritt 1

Figure 11.7.1.1: First step

Schritt 2

Figure 11.7.1.2: Second step

Schritt 3

Figure 11.7.1.3: Last step - Save patch with automatically generated file name

You will be informed about the successful creation of a patch:

Schritt 4

Figure 11.7.1.4: Success message

11.7.2 Apply patch

Developer B starts his project SpineCalcD and uploads the patch SpineCalcD-0.1.4~SpineICalcE-0.1.7.patch sent by developer A, bringing his project up to date:

S1

Figure 11.7.2.1: English version

S2

Figure 11.7.2.2: Select Patch

S3

Figure 11.7.2.3: Apply patch….

S4

Figure 11.7.2.4: English version

11.7.3 Excursus

Developer B names two copies of the project SpineCalcD as SpineCalcE and SpineCalcED, translates the project SpineCalcED and sends developer A the patch SpineCalcE-0.1.7~SpineCalcED-0.1.10.patch, which contains the changes with the translation. Developer A can apply this patch and both developers now have a version that starts the project with German texts for a German locale. Information on translating a project can be found in chapter 11.4 I18N.

All projects (SpineCalcD, SpineCalcE, SpineCalcED) and the two patch files can be found in the download area.

Download

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k11/k11.7/start.txt · Last modified: 23.09.2023 by honsek

Page Tools