facebookincubator / fastmod

A fast partial replacement for the codemod tool
Apache License 2.0
1.66k stars 41 forks source link

Feature request: Go back / Undo support #12

Closed matthewmueller closed 5 years ago

matthewmueller commented 5 years ago

First of all – this tool is sooo great! Thanks for putting this together. It replaces like 10 other tools I've cobbled together in the past.

I was wondering if it'd be possible to support going backwards? Like an undo command. Sometimes you say Y to the wrong change and it'd be really cool to be able to go back and change it.

swolchok commented 5 years ago

Thanks for contributing!

Can you elaborate on why reverting the changes to the offending file in git/hg/whatever (or manually editing) in another terminal window (and perhaps quitting/restarting fastmod) isn't going to work? I always assumed that undo for bad changes was something that would be covered by version control, and that fastmod is fast enough that a quit/restart isn't particularly onerous.

matthewmueller commented 5 years ago

Ahh good point! You could just cancel out of fastmod, make the undo, and restart and be back at the same spot again. I guess that covers it, it would probably just be a bit faster to press say u, then n.