XF 1.2 Template Merging and History

In our second updating about template improvements, we're focusing on tools to make it easier to keep your changes up-to-date and to see what changes you've been making.

Template Merging
First up is the ability to merge changes into templates after upgrading XenForo, an add-on, or a distributable style.

This is done via the existing outdated template interface:

ss-2013-04-18_11-08-03.webp


You have the option to automatically merge changes if possible. This will merge any updates where a conflict is not detected. If a conflict is detected, you will need to use the manual merge interface, which you can access by clicking on "merge changes" for a template. Here's what you'll see:

ss-2013-04-18_11-09-34.webp


The yellow and blue highlighted blocks indicate the changes that are being brought in. Blue represents a successful, non-conflicted merge (either from the parent changes or your custom changes). Yellow represents a conflict and gives you options to deal with it. In this example, I probably want to use my custom version only, but there are situations where you may need to use both (such as changes adding buttons in the same location). Note that you cannot submit this form until you have resolved all conflicts.

What if you're not happy with the changes that are being merged? You can click on any blue (successfully) merged section or any yellow (conflict) section after you've selected a conflict-resolution method. This will turn the text into a textarea that you can type in:

ss-2013-04-18_11-09-46.webp

As soon as you leave the text box, it will turn back into text to improve readability.

Note that in this example, I selected "resolve using both" so you see both parts of the conflict there, which can then be edited. I selected this to demonstrate but in this case, resolving with both blocks doesn't really make sense.

I made reference to it above, but there have been some additional changes to how templates noted as being outdated. Previously, this system could only be used when updating XenForo or an add-on. If you have installed a third-party style and kept your changes in a child style, you wouldn't see any outdated templates if you updated the third-party style. With these changes, updating a templates in a parent style will mark child templates as outdated (if necessary).

In terms of the merging, we are using an algorithm to help us reduce conflicts as far as possible. I suspect that most changes will simply be mergeable automatically but that obviously varies based on what changes you've made to the style. Regardless, it should make upgrades with customizations much easier.

Template History
Along with these merging changes, we now also track template changes for a period of time (30 days by default, configurable via option). This can make it easier to revert bad changes if needed or simply see what changes you've been making.

You can see the history when editing a template:
ss-2013-04-18_11-23-07.webp


I've cut this off at the bottom, but as you would expect you can use the old and new options to compare changes from your individual edits.
 
Excellent, was going to ask if this was possible with the current version. Definitely looking forward to the release of 1.2....
 
During an upgrade, any changed templates which you have previously edited will be flagged.
You are then presented with the view shown in the first post and given an option what to do.
If you decide to merge, it's a one click operation, more or less.

The merges are not automatic, instead you are notified and need to take action on each one.
 
The UI is really nice. Congratulations and thank you for it. Losing a template after a incorrect modification can be something so frustrating.
The modification highlighter is a home made Javascript?

I'm excited to figure out whether this can replace TMS. I'm not too sure now. I need to test it live :)
This is feature is different. It's not a template replacement, it's a kind of template history manager. But I'm not sure if there are or not some connections between the two systems.
 
I'm excited to figure out whether this can replace TMS. I'm not too sure now. I need to test it live :)
I think this is a similar feature, but will need a different mindset. TMS was overall doing a similar thing to this (merging user changes into an existing template), but going about it a completely different way by explicitly defining changes and then automatically merging them into templates whenever needed. This feature lets you implicitly define changes (by editing the templates), and then letting the system figure out how to merge those changes down the line.

If the algorithm's good, I see no reason why this can't replace the TMS for creating styles or applying small user changes. ^^
 
Nice addition Mike, should help a great deal. A little OT, but are there any plans to rework the template cache system in 1.2? As it is currently, it's borderline destructive to a board with a lot of styles installed.
 
I manage ten boards and TMS system is vital for us. I've done a TMS-addon updating all the forum in a simple and quick way...
However this is another great Mike's addition, but TMS is a wonderful and vital invention vs this "old" modifying templates system
 
Don't expect the core template modification system to be applied differently on a per style approach. If you really want to apply things differently, you could with some conditions, but we wouldn't officially recommend that.

The modification system is likely to be less user friendly and less accurate than a merging system. As someone else pointed out, it was more of an implication that managing template edits as a pain. Now, assuming no conflicts, it's basically upgrade and click two buttons to merge all the changes in. The equivalent would be checking to ensure that all of your template modifications were still being applied correctly, likely a more time consuming process anyway.
 
Don't expect the core template modification system to be applied differently on a per style approach. If you really want to apply things differently, you could with some conditions, but we wouldn't officially recommend that.

The modification system is likely to be less user friendly and less accurate than a merging system. As someone else pointed out, it was more of an implication that managing template edits as a pain. Now, assuming no conflicts, it's basically upgrade and click two buttons to merge all the changes in. The equivalent would be checking to ensure that all of your template modifications were still being applied correctly, likely a more time consuming process anyway.

Oh well. Can't have everything I suppose. I think I'm now beginning to understand the core TMS and I still think (for me) it has it's place and benefits for some stuff I want to do globally (spanned across multiple styles).
 
Top Bottom