GNOME Bugzilla – Bug 517902
"Patch" mode
Last modified: 2017-12-13 18:50:09 UTC
It would be really nice if meld has a patch mode, where you give it a file and a patch and it shows the changes. Bonus points if it handles conflicts :)
Created attachment 113205 [details] [review] Patch to add preliminary support for patch mode This patch provides *preliminary* support for patch mode. It lets meld take a directory or file + a patch file (detected as anything ending in '.patch') in that order and creates a temporary patched version of the directory/file. This mode is currently only accessible through the commandline, and works thusly: meld ./meld/trunk/ PatchMode.patch While all care has been taken with creation/removal of temp files, please don't blame me if it eats your data.
In the above patch, there are many things that could be done better. For a start, I just use the simplest patch mode possible, and if patch fails in any way at all, patch mode just bails out. i.e., no bonus points. The other big issue is that only files that are changed by the patch are copied over (otherwise it can be really, really slow) and so appear in the dirdiff as though they're missing. This could be solved by adding a specific patch mode for the directory diff mode that pretends that any file that hasn't been patched exists and is identical. I'm also not sure what the desired workflow is here; I just made it act the way I'd expect, but that's probably not the best or only option.
Looks pretty useful, even in it's current state. It would be great to have a custom treeview so that a patch could be viewed just like a directory compare if there are more than a few files changed. I wonder is it possible to use an in-memory file so we don't have to worry about cleanup issues? It would be ok to disable the file selector in this case. There's some code in vcview which handles applying patch files too. Can some of this be shared. On that thought, perhaps the patch view could be a vc plugin - there's much less work to support this compared to a new treemodel.
I'm working on a VC plugin for patch mode
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/meld/issues/16.