Deltas with difflib? 
Author Message
 Deltas with difflib?

Is it possible (in any easy way) to use difflib to create deltas
(which don't include the entire contents of both the compared
files/texts)? I realise one can strip off all lines beginning with
two spaces or something, but how about using that delta to restore one
file based on the other? I guess one could insert line counts etc. The
question is basically if anyone has done this sort of thing, or if
something like it exists. (Or if I just missed some functionality :)

As is probably obvious, I'm thinking of using this in a simple custom
version-control system.

--
Magnus Lie Hetland                                  The Anygui Project
http://www.*-*-*.com/                                   http://www.*-*-*.com/



Mon, 21 Jun 2004 03:32:13 GMT  
 Deltas with difflib?
[Magnus Lie Hetland]

Quote:
> Is it possible (in any easy way) to use difflib to create deltas
> (which don't include the entire contents of both the compared
> files/texts)?

Read the docs for difflib's SequenceMatcher class, in particular the
get_opcodes() method.  This gives you a compact accounting of how to turn
one sequence into the other.  If you don't care about matching blocks,
ignore the "equal" tuples; etc.


Mon, 21 Jun 2004 10:51:20 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Difflib question

2. difflib and analyzing filetrees

3. Teaching difflib.Differ new tricks

4. Minimal diffs in difflib?

5. difflib

6. difflib optimization -- wow (tim peters?)

7. {delta}FMT

8. Reverse delta

9. DELTA ??

10. Graph copies and Delta

11. Visual Delta J

12. Delta Forth .NET 1.2

 

 
Powered by phpBB® Forum Software