Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

treecomp.py uses the python standard library filecmp, dedicated to the purpose of comparing files and directories. Part of filecmp is a class named dircmp for comparing two directory trees. In filecmp jargon, these two directory trees are named

  • left (corresponds to our "new")
  • right (corresponds to our "old")

filecmp.dircmp is discussed here: http://www.python.org/doc/2.5/lib/dircmp-objects.html

treecomp.py (or better: treecomplib.py, see below)
uses the following methods:

  • right_only – gives you all file names that are present in the old directory. Used for detecting the violation of the assumption that the new tree shall be a superset of the old tree, in terms of filenames (see treecomp.py overview). If there are any entries in this list, an exception is thrown to signal the violation.
  • left_only – gives you all file names that are present in the new directory. Used for finding the files denoted by "xtra:" in the output.
  • diff_files – gives you all file names that are different. Used for finding the files denoted by "diff:" in the output.

The actual work of comparing is encoded in treecomplib.py, this file also contains the unit-tests and can be run stand-alone, i.e. running treecomplib.py without parameters will run the unit-tests:

...