private void applyChanges(ArrayList<Long> changeList) throws CancelledException {

		for (Long element : changeList) {
			if (currentMonitor.isCancelled()) {
				throw new CancelledException();
			}
			currentMonitor.setProgress(++progressIndex);

			long treeID = element.longValue();
			ProgramModule sourceRoot = myListing.getRootModule(treeID);
			ProgramModule destRoot = resultListing.getRootModule(treeID);

			if (sourceRoot == null) {
				if (destRoot != null) {
					// remove the other tree since there were no conflicts
					resultListing.removeTree(destRoot.getTreeName());
				}
			}
			else if (destRoot != null) {
				String sourceTreeName = sourceRoot.getTreeName();
				String destTreeName = destRoot.getTreeName();
				if (destTreeName.equals(sourceTreeName)) {
					resultListing.removeTree(sourceTreeName);
					createTree(resultListing, getUniqueTreeName(sourceTreeName), sourceRoot);
				}
				else {
					// names are different
					if (!treeStructureChanged(treeID)) {
						try {
							resultListing.renameTree(destTreeName,
								getUniqueTreeName(sourceTreeName));
						}
						catch (DuplicateNameException e1) {
							throw new AssertException();
						}
					}
					else {
						ProgramModule originalRoot = originalProgram.getListing().getRootModule(treeID);
						// if I made the changes remove the tree; if someone else
						// made the changes, leave the tree and create a new one
						if (sourceRoot.getModificationNumber() != originalRoot.getModificationNumber()) {
							// I made the changes
							resultListing.removeTree(destTreeName);
						}
						createTree(resultListing, getUniqueTreeName(sourceTreeName), sourceRoot);
					}
				}
			}
			else {
				createTree(resultListing, getUniqueTreeName(sourceRoot.getTreeName()), sourceRoot);
			}
		}
	}
Apply changes that are not conflicts.
@param changeList list tree IDs changed in the source program.
@throws CancelledException
Ghidra/Features/Base/src/main/java/ghidra/app/merge/tree/ProgramTreeMergeManager.java