• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Template Merging and History

Mike

XenForo developer
Staff member
#1
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.png


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.png


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.png

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.png


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.
 

RobParker

Well-known member
#5
In addition to 30 days, could you also include the last version before the current one (even if its outside the time range specified). For example, if I edited a template a year ago and haven't touched it since it'd be useful to see what I did then.

If I change the period from 30 days to a year then it'll (i think) store the changes for every template change in every template over the past year which is probably a bad idea and would become messy.
 

Mike

XenForo developer
Staff member
#6
Rob, keep in mind that you still have the comparison option to the parent version--my example was on the master style so that doesn't make sense. If you last changed a template a year ago, I'm not sure if the specific, per-edit changes are that useful. It makes more sense when you're trying something out and want to potentially revert it.

No harm keeping all the changes for a year except for the potential amount of data to track.
 

RobParker

Well-known member
#8
Rob, keep in mind that you still have the comparison option to the parent version--my example was on the master style so that doesn't make sense. If you last changed a template a year ago, I'm not sure if the specific, per-edit changes are that useful. It makes more sense when you're trying something out and want to potentially revert it.

No harm keeping all the changes for a year except for the potential amount of data to track.
Cheers, that makes sense.
 

Teapot

Well-known member
#19
I think this'll go a long way to mitigate the reasons we all used TMS for our own styles - so this is greatly appreciated, and makes the template modifications feature a lot more usable. Thanks! :D