Patching with Quilt
Quilt is a great program to create patches. This post is a quick ‘n’ dirty tutorial on how to create a quick patch
Assuming you have Quilt installed ,
quilt new my.patch
will create a new empty patch named my.patch
Lets say that this patch is going to affect the main.cpp file. So ,
quilt edit main.cpp
Will open the main.cpp files using your predifined editor ( $EDITOR ), allowing you to make any changes you like. When you are done , exit the editor. Now, my.patch is a ready-to-apply patch for the main.cpp file.
If you want to apply it , you should refresh the patch by doing
quilt refresh
and
quilt push
to apply it. Now you have your new main.cpp file ready to use :)
The patch is stored under patches/ folder
If you want to revert the patch you can use
quilt pop
This quide was ment to give you the main idea about the quilt program
A great guide about quilt can be found here.
Happy patching
Comments
8 Responses to “Patching with Quilt”
Leave a Reply











Isn’t all this built into Git by now?
I am not sure if git has a built-in functionality to create patches :)
Quilt is a great tool to create patches for everything. Not just cvs/svn/git repos ;)
Seems useful for folks who don’t want to use hg or git for one reason or another, no? =)
Almost everything I have that *might* need a patch is already a Mercurial repo, since it’s pretty trivial to make a directory a git or hg repository (`hg init && hg addremove && hg commit -m ‘init’`). quilt creates a ‘patches’ and ‘.pc’ directory in each directory you use it, whereas hg and git create one in the root node of your dir tree (repo).
I’m being judgemental only because functionality like this already exists in these tools, plus a ton of other flexible useful bells for this workflow (pushing and emailing changesets, incremental backups, changeset merging, cherry-picking etc).
It sounds as if quilt wants to be a lightweight VCS solution (topmost patches etc) but in the end it ends up being more heavyweight and.. uhm.. crippled? =)
/me turns off troll mode.
Exactly. If you are using VCS you might not want Quilt . But if you are working on a folder outside of a repo, quilt is a great tool to do your job.
I am usually developing on “offline” folders ( folders outside the repo ). I am creating the patches using quilt. When I am done, I move the modified code on the repo.
I am just not confident enough to play inside the repo :). I prefer doing this, inside a “sandbox” :)
I forgot to link to this introduction to Mercurial Queues, which explains that this extension’s history originates exactly from quilt.
http://hgbook.red-bean.com/hgbookch12.html
Markos, concerning working on the repo, I usually run `hg clone . ../sandbox`, do whatever I want and then push the changesets back to the original repo. In fact, I have one which reflects upstream (b-upstream), a working tree (b-main) and others where I try various things. ‘b-upstream’ has a hook which automatically pushes to all public instances (more than one, like in upstream, bitbucket, etc).
Nice link thank you ;)
The way you work is similar to mine. Well, I am working on git repos but I guess there are not huge differences between Mercurial and Git
Also, quilt is very handy when you are working on kernel bugs. You have your local git clone from linux tree, creat the patch, push it ( apply it locally ) , compile, testing. If it works, you grub the patch from patches folder and commit it upstream
Really quick and handy
Hey thanks for the howto, i wasn’t completely sure after reading the MANPAGE, but this little howto change it really quick :)
D.
Thanks.
You should read http://www.suse.de/~agruen/quilt.pdf . It will help you a lot ;)