bmwill / diffy

Tools for finding and manipulating differences between files
Apache License 2.0
75 stars 22 forks source link

added reverse operation to reverse a patch #26

Closed brandonpollack23 closed 9 months ago

brandonpollack23 commented 10 months ago

I needed a simple undo operation for a project I'm considering working on. I liked how simple diffy was to use so I added/tested this and thought maybe you would be so kind as to give feedback or accept it :)

bmwill commented 9 months ago

Thanks for the contribution! This looks good and fairly straightforward. I'll work on fixing the lint that is failing elsewhere in the code and then I'll get this merged. And sorry for the delay!

brandonpollack23 commented 9 months ago

Oh yay thank you :)

brandonpollack23 commented 3 months ago

Me in would be correct.

On Sun, Jun 30, 2024, 22:25 Emanuel Czirai @.***> wrote:

@.**** commented on this pull request.

In src/diff/tests.rs https://github.com/bmwill/diffy/pull/26#discussion_r1660180713:

  • l @ Line::Context(_) => assert_eq!(l, reverse),
  • Line::Delete(d) => assert!(matches!(reverse, Line::Insert(i) if d == i)),
  • Line::Insert(i) => assert!(matches!(reverse, Line::Delete(d) if d == i)),
  • }
  • }
  • }
  • let re_reverse = apply(&apply("", &p).unwrap(), &reverse).unwrap();
  • assert_eq!(re_reverse, ""); +}
  • +#[test] +fn reverse_multi_line_file() {

  • let original = r"Commander Worf +What do you want this time, Picard?! +Commander Worf how dare you speak to mean that way!

is mean here a typo? is it meant to me or me in ?

— Reply to this email directly, view it on GitHub https://github.com/bmwill/diffy/pull/26#pullrequestreview-2150052029, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBR3263DLSBWVBV6EG2SQTZKABMHAVCNFSM6AAAAABKEDRDN6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCNJQGA2TEMBSHE . You are receiving this because you authored the thread.Message ID: @.***>