开发者

Graphical patch utility

开发者 https://www.devze.com 2023-01-03 18:25 出处:网络
I have a kernel patch for a slightly different kernel version then the one I\'m trying to patch. Needless to say, th开发者_如何学运维e patch partially fails. I can certainly fix it manually, but I was

I have a kernel patch for a slightly different kernel version then the one I'm trying to patch. Needless to say, th开发者_如何学运维e patch partially fails. I can certainly fix it manually, but I was wondering maybe there is a graphical patch utility that can be used to resolve the conflicts.


There are many graphical patching utilities, try meld, diffuse, kdiff3 or dirdiff, they should be packaged for your distribution.

Another useful tool is wiggle, which "tries harder" to resolve conflicts, and will turn a rej file from patch into a CVS-style inline conflict with >>> markers.

I tend to use it with an underlying revision system, so I'm happy to revert its changes if they're wrong, as such I use:

wiggle -v --replace <file> <file.rej>

Which says to do the transformation in place, sometimes it will just do the right thing, other times you end up with >>> markers and can edit by hand, but it's easier than using a rej file by hand. If it really does a bad job I use my revision control system (git) to revert back to the original.


I don't know about a graphical patch utility, but what I would probably do is obtain the file(s) in the old kernel version, apply the patch to obtain patched old file(s) (keeping the old file(s)), obtain the file(s) in the new kernel version, and then use a 3-way merge tool such as GNU Meld.

This procedure is a little time consuming, but I have found it extremely helpful in resolving Subversion conflicts (very similar to what you are trying to accomplish). And, it allows you to quickly ascertain how different the file(s) in the two kernel versions are, what has changed, and various changes that you will likely need to make to the patch lines in order to make them compatible with the new file(s).


Yeah, I ran into a similar situation while trying to apply Firefox Light v27 patches to Firefox v28 beta 4. The Mozilla team renamed some things, so it's not a direct drop in. I was hoping to do this so I could compile it for Linux. I ended up opening the patch in one text editor, and the code in another.

It was Mousepad, but it coulda been any simple text editor for that matter, gEdit, Leafpad, Geany... Then did all the mods by hand, side-by-side, from one window to the next, but it's so slow that way. "Find" was helpful in jumping to the right edit locations.

I should also mention that if you paste the piece of the patch you're using into an empty window, you can Find-and-Replace the + symbol then replace it with nothing, so it strips it down to usable code... Which is easier for large blocks of added code, instead of twiddling your fingers on the up-arrow and delete keys.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号