Merging a patch/diff generated by difflib?

Discussion in 'Python' started by erikcw, Mar 18, 2008.

  1. erikcw

    erikcw Guest

    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!
    erikcw, Mar 18, 2008
    #1
    1. Advertising

  2. On Mar 18, 6:08 am, erikcw <> wrote:
    > 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
    Raymond Hettinger, Mar 18, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cyril Vi?ville

    diff Process under diff users

    Cyril Vi?ville, Jun 29, 2004, in forum: Perl
    Replies:
    1
    Views:
    494
    Joe Smith
    Jun 29, 2004
  2. Berrucho
    Replies:
    2
    Views:
    614
    Infant Newbie
    Dec 5, 2003
  3. A Traveler

    Diff CSS styles for diff INPUT TYPE='s?

    A Traveler, Aug 31, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    4,900
    Steve Fulton
    Aug 31, 2004
  4. XML diff/XML patch

    , Sep 27, 2007, in forum: XML
    Replies:
    2
    Views:
    685
    Juergen Kahrs
    Sep 27, 2007
  5. Austin Ziegler

    [ANN] Diff::LCS 1.1.0, Diff::LCS 1.0.4

    Austin Ziegler, Aug 8, 2004, in forum: Ruby
    Replies:
    3
    Views:
    173
    Austin Ziegler
    Aug 9, 2004
Loading...

Share This Page