using treecomp.py
treecomp.py
is located in the Development\Remotion-Contrib\PhoneBook\trunk\tools
directory. It accepts two parameters on the command line:
- the
new
directory. This will be the path to the PhoneBook template tree - the
old
directory. This will be the path to the re-motion template tree
Thus you invoke treecomp.py
like this (in the tools
subdirectory):
treecomp.py c:..\Remotion\UIGenTemplates C:\Development\Remotion-Contrib\Web.CodeGenerator\trunk\Templates
The output from treecomp.py
will be a batch script for copying the modified (different) files from the PhoneBook template tree to the re-motion template tree. If the two trees are alike, you will see:
*** NOTHING TO DO *** REM diff: REM xtra:
After the last template innovation cycle our output looked like this, however:
C:\Development\Remotion-Contrib\PhoneBook\trunk\tools>treecomp.py c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates C:\Development\Remotion-Contrib\Web.CodeGenerator\trunk\Templates REM diff: c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\EditControl.ascx.cs REM diff: c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\SearchResultControl.ascx.cs REM diff: c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\SearchResultForm.aspx REM diff: c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\EditForm.aspx.designer.cs REM diff: c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\SearchResultForm.aspx.designer.cs REM diff: c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\EditForm.aspx REM diff: c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\EditForm.aspx.cs REM diff: copy c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\EditControl.ascx.cs C:\Development\Remotion-Contrib\Web.CodeGenerator\trunk\Templates\TabbedEditor\WebClient\UI\EditControl.ascx.cs copy c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\SearchResultControl.ascx.cs C:\Development\Remotion-Contrib\Web.CodeGenerator\trunk\Templates \TabbedEditor\WebClient\UI\SearchResultControl.ascx.cs copy c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\SearchResultForm.aspx C:\Development\Remotion-Contrib\Web.CodeGenerator\trunk\Templates\TabbedEditor\WebClient\UI\SearchResultForm.aspx copy c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\EditForm.aspx.designer.cs C:\Development\Remotion-Contrib\Web.CodeGenerator\trunk\Templates\TabbedEditor\WebClient\UI\EditForm.aspx.designer.cs copy c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\SearchResultForm.aspx.designer.cs C:\Development\Remotion-Contrib\Web.CodeGenerator\trunk\Templates\TabbedEditor\WebClient\UI\SearchResultForm.aspx.designer.cs copy c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\EditForm.aspx C:\Development\Remotion-Contrib\Web.CodeGenerator\trunk\Templates\TabbedEditor\WebClient\UI\EditForm.aspx copy c:\Development\Remotion-Contrib\PhoneBook\trunk\Remotion\UIGenTemplates\TabbedEditor\WebClient\UI\EditForm.aspx.cs C:\Development\Remotion-Contrib\Web.CodeGenerator\trunk\Templates\TabbedEditor\WebClient\UI\EditForm.aspx.cs REM xtra:
In this case, there were only different files (seven of them, to be exact), no extra files. Thus the REM xtra
section is empty (maybe next time).
toy use
You can try out treecomp.py
on the directory trees established for its unit-tests (see next section: How treecomp.py works).
Don't run the resulting scripts!
You might be tempted to do with the toy batch script output what you are supposed to do with them in real life: run them. However, resist this urge!
This will break the unit-tests!
Identical trees:
C:\Development\Remotion-Contrib\PhoneBook\trunk\tools>treecomp.py trees\equal-trees\new trees\equal-trees\old *** NOTHING TO DO *** REM diff: REM xtra:
This invocation for unequal-trees
finds a file named extra.txt
in one subdirectory and differences between the two lolz.txt
files. These files will be copied when the corresponding sections in the batch file are executed:
C:\Development\Remotion-Contrib\PhoneBook\trunk\tools>treecomp.py trees\unequal-trees\new trees\unequal-trees\old REM xtra: trees\unequal-trees\new\extra.txt REM diff: trees\unequal-trees\new\lolek\lolz.txt REM diff: copy trees\unequal-trees\new\lolek\lolz.txt trees\unequal-trees\old\lolek\lolz.txt REM xtra: copy trees\unequal-trees\new\extra.txt trees\unequal-trees\old\extra.txt
The following invocation throws and exception, because an extra file is found in the old tree. In other words, it is missing from the new tree:
C:\Development\Remotion-Contrib\PhoneBook\trunk\tools>treecomp.py trees\bogus-trees\new trees\bogus-trees\old Traceback (most recent call last): File "C:\Development\Remotion-Contrib\PhoneBook\trunk\tools\treecomp.py", line 8, in <module> gFileList = treecomplib.CmpWalker (gNew, gOld, [".svn"]) File "C:\Development\Remotion-Contrib\PhoneBook\trunk\tools\treecomplib.py", line 36, in CmpWalker CmpWalkerCore (new, old, ignore, accu) File "C:\Development\Remotion-Contrib\PhoneBook\trunk\tools\treecomplib.py", line 24, in CmpWalkerCore raise MissingFileOrDirectoryException (old, cmp.right_only) treecomplib.MissingFileOrDirectoryException: Files missing from old (2nd) directory: - trees\bogus-trees\old\extra.txt
The last line is the "list" of missing files, only one entry long.