8.2.10 Merge

The method Node.merge can be thought of as a version-sensitive Node.update. It works as follows:

The merge method can be called on a versionable or non-versionable node.

Like update, merge does not respect the checked-in status of nodes. A merge may change a node even if it is currently checked-in.

If this node (the one on which merge is called) does not have a corresponding node in the indicated workspace, then the merge method returns quietly and no changes are made.

If this node does have a corresponding node, then the following happens:

Note that as a result of the final rule, above, a merge performed on a subtree with no versionable nodes at all (or indeed in a repository that does not support versioning in the first place) will be equivalent to an update.

The merge method returns a NodeIterator over all versionable nodes in the subtree that received a merge result of fail.

Note that if bestEffort is false, then merge will either return an empty iterator (since no merge failure occurred) or throw a MergeException (on the first merge failure that was encountered).

If bestEffort is true, then the iterator will contain all nodes that received a fail during the course of this merge operation.