Difference between revisions of "DiffWML"

From The Battle for Wesnoth Wiki
(Document the diff format)
 
(Add note about the =x convention for deleted keys)
Line 4: Line 4:
  
 
* '''[insert]''': Contains keys that were added to the config, or that changed value.
 
* '''[insert]''': Contains keys that were added to the config, or that changed value.
* '''[delete]''': Contains keys that were removed from the config.
+
* '''[delete]''': Contains keys that were removed from the config. The value is ignored, but is conventionally set to "x".
 
* '''[change_child]''': Indicates a change to an existing subtag.
 
* '''[change_child]''': Indicates a change to an existing subtag.
 
** '''index''': Specifies the index of the tag that changed. The index is 0-based and counts through all tags, not just those of the same name.
 
** '''index''': Specifies the index of the tag that changed. The index is 0-based and counts through all tags, not just those of the same name.

Revision as of 02:08, 14 November 2018

The DiffWML is a special WML format used to describe changes to a WML config.

A diff consists of the following keys and tags:

  • [insert]: Contains keys that were added to the config, or that changed value.
  • [delete]: Contains keys that were removed from the config. The value is ignored, but is conventionally set to "x".
  • [change_child]: Indicates a change to an existing subtag.
    • index: Specifies the index of the tag that changed. The index is 0-based and counts through all tags, not just those of the same name.
    • DiffWML keys and tags
  • [insert_child]: Indicates the insertion of one or more new tags in the config.
    • index: Specifies the index of the tag before which these new tags were inserted. The index is 0-based and counts through all tags, not just those of the same name.
    • All other subtags are the actual tags that were inserted into the config at this position.
  • [delete_child]: Indicates the deletion of one or more tags from the config.
    • index: The index of the tag to delete. The index is 0-based and counts through all tags, not just those of the same name.
    • An empty tag with the same name as each of the deleted tags to remove from that location.

Diffs generated by Wesnoth only use a single tag in each [insert_child], [delete_child], and [change_child]. However, multiple children will be handled when applying a diff to a config.