6

We faced the following issue with Unicorn serialisation and I wanted to share it just in case someone has a better solution/workaround to it.

We are using Unicorn 2.0.4 on a project where we cannot (at least by now) upgrade to Unicorn 3.

When an item is renamed on Sitecore, unicorn doesn't detect it and *.item files remain on disk with their original names and content with the following attributes:

  • path: Pointing to the original path which is wrong
  • parent: Pointing to their parent Id which is right as the id didn't change in the rename.

Moreover, if the renamed item has children then the *.item files representing those children are not updated either. They are kept in a folder with the old name and with their "path" attribute pointing to the wrong path.

If the developer has several *.item files with changes to be comited it is easy commit them without realising about the issue in which case the changes are lost.

Things can get even worse if additional changes are done to the renamed item (or its children) then Unicorn create new *.item files only for those items that are updated. If there are other descendant not being updated then their associated *.item file is not created. This scenario makes more difficult to detect the missing items and more time consuming to fix it.

Once the issue is detected then we need to make sure all items in a subtree are serialised. The only way (I know) to do it is by manually modifying all descendants, one by one, which implied:

  1. Edit any field
  2. Save the item
  3. Restore the field to its original value
  4. Save the item again

Once all items have been serialised, we have to delete the old *.item to avoid duplications when reverting serialised items.

My main questions are:

  1. Does anyone know a way to make Unicorn detect item re-naming?
  2. Is there an easy way (without changing serialisation configuration) to make Unicorn serialise an item with its children?

Additional questions are:

  1. Does Unicorn 3 handle this scenario better?
  2. Does TDS have this issue?
1
  • 2
    Yes, Unicorn 3 handles everything better :)
    – Kam Figy
    Oct 7, 2016 at 15:53

1 Answer 1

5

This is hard to answer because it's really several questions at once. To start with, YES Unicorn 3 handles things much better because it has more control over its serialization system. Unicorn 2 is a bit hamstrung because it's using the built in APIs which have some fun bugs.

Unicorn 2.x should, however, support most kinds of renaming without issue. If your items are deeply nested, that could cause issues (the way Sitecore's serialization format handles long paths is ugly). Check your configuration and make sure the config files are unmodified.

If you're using the same dataFolder\serialization root folder that Sitecore serialization uses, the "Dump Tree" button on the Developer tab of the ribbon should dump a single tree for you, making sure it's all serialized. If you have a different root, you'll need to reserialize but that dumps the whole thing. In Unicorn 3.x, it takes over the (dump/serialize) tree and item for items it knows about, enabling just this use case.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.