Handling merge conflicts resulting from Theme Upgrade
When you upgrade your theme, UltraCart looks at all the files within your theme that have been modified. Â If the file has been modified, UltraCart will calculate two sets of change records:
- Previous Version and Your Modified Version
- Previous Version and New Version
As long as none of the changes occur within the same region of the Previous Version then the merge will be clean and no conflicts will occur. However if you modified line 100 of a template and the theme developer also modified line 100 in a different way then a merge conflict will occur. Â
The active theme cannot be upgraded if any merge conflicts are detected to avoid breaking the live site.
UltraCart does a pre-upgrade check to see if any merge conflicts are going to occur. Â If so, the system will force you to:
- duplicate your theme
- upgrade the duplicate
- resolve the merge conflicts
- activate the new theme
This will protect your production site during the upgrade process. Â At the end of an upgrade, if there are merge conflicts the result dialog will tell you the file paths of the templates in conflict. Â
To find and resolve the merge conflicts first navigate to the File Manager as shown below.
Â
Â
Now click on the Merge Conflicts search icon shown in the toolbar. Â This will find all the files within your StoreFront that have merge conflicts. Â You will also notice that the words "merge conflict" appear in brackets to the right of the version number if the file contains any conflicts.
Â
Click on the file name and it will open up the file editor.
When the file editor first appears there will be a warning at that top indicating that the file contains merge conflicts like the example below. Â You can click on the orange warning and it will dismiss.
The middle section of the merge editor will be the final document. Â At the top of the middle editor is an indication of the number of merge conflicts in the file. Â As you scroll down the file you will see the merge conflicts as shown below.
The next step is to decide which code block to merge into the final result. Â The left side editor is the new theme file with your changes applied (except for the conflict areas) and the right side is your file with changes applied (except for the conflict areas). Â Click one of the two merge arrows to move the content over.
After the merge conflicts are resolved the counter at the top of the page will show zero and the save button will enable.
Â
Some merge conflicts are complex depending upon the edits you've made to the template. You should always analyze the final merged file to make sure the code is correct.