If changes are made on the remote ticket and local ticket at the same time, how are the conflicts merged?

Originally asked by tyler denbo on 18 August 2021 (original question)


If changes are made on the remote ticket and local ticket at the same time, how are the conflicts merged?


Answer by Ariel Aguilar on 18 August 2021

Hi Tyler,

It really depends on how Exalate is configured. In this explanation, I will refer to Script based connections. If changes are made on both sides, Outgoing Script rules are executed on each side. Then, if it’s properly configured you can definitely add clauses on how the data needs to be synched on the Incoming rules.

Here is one “use case” for which you can understand a bit better what I am referring to:

I have an issue synced on project A and project B with the fields:

  • Description: <empty>
  • Labels: <empty>

On both sides.

Then I edit the description on side A and the labels on side B, at the same time, so I have:

On side A:

  • Description: “Test desc”
  • Labels: <empty>

On side B:

  • Description: <empty>
  • Labels: Test_label

After the synchro, I have this:

On side A:

  • Description: <empty>
  • Labels: Test_label

On side B:

  • Description: “Test desc”
  • Labels: <empty>

I would like to have both changes merged on both sides:

On side A:

  • Description: “Test desc”
  • Labels: Test_label

On side B:

  • Description: “Test desc”
  • Labels: Test_label

Solution:

This should help you to avoid receiving null values. Add this code to the incoming rules:

if (replica.description != null) {
issue.description = replica.description
}
if (replica.labels != null) {
issue.labels = replica.labels
}

For example, this code represents a way for you to handle values / null values collisions.

If you refer to something else like comments, you can use a commentHelper function to avoid this type of problems. You can refer to the following article to check out its functions depending on the instance: https://docs.idalko.com/exalate/display/ED/commentHelper

Kind regards,

Ariel