-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply patch on current state #20
Comments
Thanks for the suggestion! I foresee problems with conflicts if we implemented this feature...although I guess we could simply apply the patch, conflict markers and all, and let the user figure out how to resolve them. One thing you can do now is navigate to '3' and press 'd' to diff 3 with 6. You can then pull over the changes you want to get to 7 - not quite automatic, but possble at the moment... |
Thanks for the quick reply and for pointing out the temporary workaround. I think having this feature will speed workflow quite a bit.
That behaviour sounds correct to me. If the user doesn't like the conflict patch they can always undo ;-) |
I think it is just like the git tree,if you want to merged 3 into 6 ,I think it is not |
Certainly, it is a non-trivial feature. But, (along with undo'ing just that change) if possible, it would be a very useful feature. Quite often the changes would not conflict. I think the best way would be to construct a git repository in-memory of the current file, and apply the 3 changes required (the state before the selected change, the state at that change, and the current state) as three commits, and then do the cherry-pick or revert respectively and make a new change in the buffer which sets the state to whatever git output; which would often be non-conflicted, and would otherwise have conflict markers in the file. |
We do use difflib under the covers to generate the unified diff format; we could simply implement 'apply patch' two a set of strings. This provides some options: https://stackoverflow.com/questions/2307472/generating-and-applying-diffs-in-python My best guess of a heuristic:
|
I would really like to be able to apply a patch from a previous undo onto my current state, not just having to revert completely to that state.
For example, in the image below, apply the patch made on 3 onto my current state 6, leaving me in a new state 7 with the patch from 3 applied.
Thanks for picking up the development of this plugin :-)
The text was updated successfully, but these errors were encountered: