efc.compareTrees is a helper script, not a command.  I am using it to 
compare corresponding classes in viewrendered.py and viewrendered2.py.  
Here is the code from leoPlugins.leo:

p1 = g.findNodeAnywhere(c, 'class ViewRenderedController (QWidget) (vr)')
p2 = g.findNodeAnywhere(c, 'class ViewRenderedController (QWidget) (vr2)')
assert p1 and p2
tag = 'compare vr1 & vr2'
c.editFileCommands.compareTrees(p1, p2, tag)


This creates a tree whose root headline is the given tag.  The format of 
tree is much like "Recovered Nodes" trees.  That is, the body text of child 
nodes show the diff produced by difflib.unified_diff. Grand children are 
clones of the compared nodes, or a single clone if a node in one class has 
no analog in the other class.

At present, this code is not undoable.  The workaround is simply to cut the 
node ;-)

It might be good to create a command based on this code, but this isn't 
real important, imo.

As I write this, I realize that documenting c.recursiveImport *is* 
important.  It should be mentioned in the scripting miscellany 
<http://leoeditor.com/scripting-miscellany.html>. I'll be documenting 
efc.compareTrees there as well.

The code finds corresponding nodes by munging headlines.  It works well 
enough for vr and vr2, but the munging could be improved to find more 
corresponding nodes.  Otoh, I expect to rearrange the resulting tree by 
hand while studying the results, so getting close is all that is really 
required.

This code much better than trying to used multiple body editors to compare 
code.  The combination of diff-oriented text combined with clones of the 
corresponding nodes is pretty much exactly right.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to