Tree.

changes(oldTree, newTree)

This compares an old map-based with a new one. It does this by obtaining a manifest for both trees and then looking for differences. This function returns a new tree of strings (“added”, “changed”, or “deleted”) that describe the changes.

This function is also exposed as Dev.changes so that you can omit the Tree. prefix when calling the function from the command line. Also see the Dev.changes page for how you can use the command to test static sites.

Example #

A YAML file contains the following tree:

# oldTree.yaml
a:
  b: old text
  c: old text
  d: old text

The file is copied and then modified to produce:

# newTree.yaml
a:
  b: new text
  c: old text
e: new text

Calling changes indicates what values have changed:

$ ori changes oldTree.yaml, newTree.yaml
a:
  b: changed
  d: deleted
e: added

Invoking changes if the trees are the same returns an empty object, indicating nothing has changed:

$ ori changes newTree.yaml, newTree.yaml
$