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.
 
1.2 has been one hell of an update for the admins, but next time I would like to see some more new features the public can see.

On our big board, we actually need quite a few admin and moderation improvements, as we're missing tools we used frequently in vb.

We're always wary to give members any new features--they're sometimes like whiney old ladies any time something changes. :D
 
Great stuff.

Just a (possibly stupid) question. Will there also be a way to compare the old version with the current one or simply revert back to an old version easily?

Scott
 
@Mike - I've been thinking about this upcoming feature more and had a question: many use the EXTRA.css template (and some of us commercial style producers use our own version of that template) by placing our customized versions of CSS elements in there rather than editing the parent template of that element...will this tool be able to identify and compare customized elements out of it's parent template? (sorry if this has been asked/answered elsewhere already)
 
This is looking quite awesome! I have some technical questions though.

Is this doing two-way merging or three-way merging? Based on the screenshots and description, it looks like a 3-way merge is being performed, but it's hard to tell exactly which templates/versions are being used. Does the XenForo core store past versions of the master templates for use in a 3-way merge with custom/child styles?

What happens if I upgrade from, say, 1.1.3 to 1.1.5 (assuming the feature was in 1.1.x)? I skipped 1.1.4. Will the system perform a 3-way merge between the 1.1.3 master template, the 1.1.5 master template, and my custom template (which was based off of the 1.1.3 master template)? How far back does this source history go?

And furthermore, is the version history retained when exporting a style? Let's say I have a custom style I developed. It's currently on version 1.0. My customer made changes to my style in a child style within XenForo. I then release an update to my style (version 1.1). My customer installs this by overwriting/updating the parent to their customized child style. Can XenForo perform an intelligent 3-way merge between the base ancestor (my style 1.0), the new version of my style (my style 1.1), and the customized child style my customer made (which is obviously descended from my style 1.0)?

If the answer is yes, this is a godsend and will solve almost all style customization and update issues. People will just have to learn how to resolve conflicts, which isn't really a difficult thing to do.

Looking forward to the answers to these questions, thanks!
 
It's 3 way merging based on the last version of the parent data before your most recent child style edit for that template.

Merging is possible between parent and child styles (same concept as between a style and the master).
 
It's 3 way merging based on the last version of the parent data before your most recent child style edit for that template.

Merging is possible between parent and child styles (same concept as between a style and the master).

Awesome! In that case, how does overwriting/updating a 3rd-party style work? If I upload a style and select the "overwrite" option (as it exists in 1.1.x - haven't tried the beta yet), does it completely wipe out the version history for that style or does it add the imported style as a new version in the version history? :)
 
"Search Templates" and change the template status and style as necessary. Don't enter in any contents.
 
I don't know if this was asked before, but why can't we merge changes from templates older than 1.2? It's just because they don't have a history record or something else?
 
I am doing this right now and the only thing I get when I try to merge changes is „No previous version of the parent could be found. Merging is not possible.“
 
You can't merge if you import a style from elsewhere. We use edit dates to determine the version which your template is based on and if you import, that's not possible. (This system allows you to merge between parent and child styles.)

The other alternative is that the template history has been removed, but by default this is after something like 60 days.
 
Well, the style obviously has all the data about template versions and as far as I know it wasn't imported from somewhere else after 1.2 upgrade, it was there during the upgrade.
But why can't we just create a new history record „on the fly“ when merging changes? In fact, I've never used TMH to upgrade templates from 1.1.5 to 1.2, on any site, so I did all the changes by hand and thought that <1.2 is just not supported.
 

Attachments

  • versions.webp
    versions.webp
    18.1 KB · Views: 40
Top Bottom