treecomp.py overview

treecomp.py compares two directory trees and identifies differences between them. It is designed with a single purpose in mind, and this is comparing the PhoneBook template tree to the re-motion template tree.

Modifying/debugging templates is usually done in the PhoneBook template tree and migrated to the re-motion
template tree after completion. With treecomp.py you can

  • make sure that the two trees are identical (as they are supposed to be)
  • find out which files you have changed during a template innovation cycle (see Backstage, meta, shop floor top-level page).
Assumptions

treecomp.py is based on the following assumptions:

  • the PhoneBook template tree is the "new" (modified) template tree
  • the PhoneBook template tree might contain new files not present in the old template tree, but not the other way around
  • PhoneBook template files will be copied to the re-motion template tree, but not the other way around

In the future, these assumptions might break. treecomp.py is not very useful if you want to migrate files in the other direction – from the re-motion template tree to the PhoneBook template tree.

Workings

treecomp.py reports only two types of differences:

  • different files
  • extra files in the new template tree

It does not report

  • extra directories in the new template tree
  • extra files in the old template tree

If treecomp.py finds files in the old template tree that are not present in the new template tree, it will throw an exception with the list of files not found in the first directory where this is the case.

treecomp.py prints a batch (.cmd) file of copy-commands to stdout. You can pipe this output to a batch file, inspect and change it with your favorite editor or not, and run that batch file to update the re-motion template tree from the PhoneBook template tree.

This output has three sections:

  • a list of files that are found to be different each line preceded by either "diff: " or "xtra: "Each of these lines/paths is commented out with REM
  • the list of copy commands for files that must be copied, because they are different (headed by REM diff)
  • the list of copy commandds for files that must be copied, because they are not in the old tree yet (headed by REM xtra)
What about subversion directories (".svn")?

.svn directories in both template trees are ignored and not compared.