MetaEditor Help

Merging Changes

Merging Changes

One of the major advantages of the MQL5 Storage is that it allows multiple users to work with the same files.

The possibility of granting other users the right to edit folders in the personal storage has not yet been implemented. However, at this point, you can work with the storage from multiple computers using the same MQL5.community account.

Merging means combining changes made to the local copy of data with the data that are changed in parallel and recorded in the MQL5 Storage.

  • Merging is only for text files with the source code (mq4, mq5, mqh, cpp, h) in ANSI. Bmp and wav files are always completely replaced by newer versions.
  • Source code files are compared line by line. When conflicts arise (for example, in the local file and in the corresponding file in the repository one the same line is changed) the merging algorithm aims to maximize the preservation of local changes.

An Example of Merging

Let's consider a typical case of merging of two files. As mentioned above, during merging source code files are compared line by line. If a file in the storage contains the lines that are not present in the local file, these lines are added. For example, a file in the storage contains the following code:

File in the storage

The same local file contains the following code:

Local file

After you click "Update from Storage Update from Storage", the local files remains unchanged, since local changes are of higher priority. However, if a file in the storage contained the following code:

File in the storage

The line "x=0;" would be added in the local file, while "return(true);" would remain unchanged:

Updated local file

  • The most important principle of merging is the higher priority of local data. The algorithm seeks to maximize the preservation of local changes.
  • There are many types of conflicts during merging. In this section, was considered just one of the most common situations. The merging algorithm is complex and provides a comprehensive approach in the analysis files. More information about the merger can be found in a book on Subversion.