Merging a patch/diff generated by difflib?

E

erikcw

Hi,

I'm trying to create an undo/redo feature for a webapp I'm working on
(django based). I'd like to have an undo/redo function.

My first thought was to use the difflib to generate a diff to serve as
the "backup", and then if someone wants to undo their operation, the
diff could just be merged/patched with the current text.

However, I've not be able to find a patch library. Are there any
libraries that will handle merging the diff back into the text?

Thanks!
 
R

Raymond Hettinger

Hi,

I'm trying to create an undo/redo feature for a webapp I'm working on
(django based). I'd like to have an undo/redo function.

My first thought was to use the difflib to generate a diff to serve as
the "backup", and then if someone wants to undo their operation, the
diff could just be merged/patched with the current text.

However, I've not be able to find a patch library. Are there any
libraries that will handle merging the diff back into the text?

The difflib module has a restore() function.


Raymond
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top