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

Discussion in 'Have You Seen...?' started by Mike, Apr 18, 2013.

  1. Mike

    Mike XenForo Developer Staff Member

    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:


    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:


    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:

    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:

    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.
    Liam W, Ryan_, dwdmadmac and 88 others like this.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Very, very nice.

    Great work as ever Mike.
  3. RobParker

    RobParker Well-Known Member

  4. CyclingTribe

    CyclingTribe Well-Known Member

    History should come in very handy for those times when you overwrite a change and then can't remember WTH you did in the first place ... :D

    Good stuff. Looking forward to 1.2 (y)
    optrex and Tracy Perry like this.
  5. RobParker

    RobParker Well-Known Member

    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.
  6. Mike

    Mike XenForo Developer Staff Member

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

    tyteen4a03 Well-Known Member

    One more addon (XenMerge) I can uninstall. :D

    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.
    Markos and faeronsayn like this.
  8. RobParker

    RobParker Well-Known Member

    Cheers, that makes sense.
  9. lazer

    lazer Well-Known Member

    ..just pee'd...

    Great addition (y)
    mjp likes this.
  10. Luxus

    Luxus Well-Known Member

    Is member_notable a made up template or new in 1.2? :)
    IcEWoLF, Adam Howard and ManOnDaMoon like this.
  11. Mike

    Mike XenForo Developer Staff Member

    I was wondering when someone would notice that... :)
    Ryan_, nirgeorge, IcEWoLF and 7 others like this.
  12. CyberAP

    CyberAP Well-Known Member

    Now we need syntax highlighting and Tab key support and we are ready to work with templates locally.
    duydangle, RobinHood, gldtn and 4 others like this.
  13. tyteen4a03

    tyteen4a03 Well-Known Member

    I thought it was just some templates to show off this feature.

    Well-played... :p
  14. RobParker

    RobParker Well-Known Member

    Hmm, a "top posters" section perhaps?
  15. Biker

    Biker Well-Known Member

    This will be a VERY welcome addition!
  16. Andy.N

    Andy.N Well-Known Member

    We can finally remove TMS addon now?
  17. giorgino

    giorgino Well-Known Member

    I don't think so... because the styles issue...
    Adam Howard likes this.
  18. Hoffi

    Hoffi Well-Known Member

    Great addition!
  19. Teapot

    Teapot Well-Known Member

    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
  20. Crayo

    Crayo Active Member

    What a fantastic update. Great work.

Share This Page