Main / Quilt
Quilt tracks patches in a stack-like manner, and is reminiscent of a simple source control system. There will be only one "active" patch, the top of the stack. When you make edits, they will be associated with the active patch. Quilt has push and pop commands to put known patches onto the stack and take them off. The files on disk are changed or reverted as the pushes and pops occur. Patches must be created (simply named, that is) before they can exist on the stack. When you make edits to a file associated with a patch, you must "commit" the edits to the patch before quilt saves them. When you delete patches, the file edits are also undone. QUILT TUTORIAL create test directory, where all commands in this tutorial will occur $ mkdir QUILTTEST $ cd QUILTTEST create patches directory $ mkdir patches create a new patch $ quilt new mypatch.patch Patch mypatch.patch is now on top list the patches managed by this series, on or off the stack $ quilt series mypatch.patch see where the patch is stored Quilt has a created two directories: patches and .pc $ cat patches/series mypatch.patch create file and add to current patch (write some random stuff) $ nano source.c $ quilt add source.c File source.c added to patch mypatch.patch edit the file (add some random stuff) $ nano source.c OR $ quilt edit source.c (you can change the editor with the EDITOR variable) see the diff $ quilt diff Index: QUILTTEST/source.c =================================================================== --- QUILTTEST.orig/source.c 2016-12-19 15:43:58.075552604 -0700 +++ QUILTTEST/source.c 2016-12-19 15:52:06.883532402 -0700 @@ -1 +1,2 @@ #define ATHING +#define ADDEDTHING revert the changes to the file $ quilt revert source.c Changes to source.c in patch mypatch.patch reverted see the diff now (nothing) $ quilt diff re-do the edit manually $ emacs source.c OR $ quilt edit source.c see the quilt file tree $ tree -L 4 -Ra . ├── patches │ └── series ├── .pc │ ├── applied-patches │ ├── mypatch.patch │ │ └── source.c │ ├── .quilt_patches │ ├── .quilt_series │ └── .version ├── source.c └── source.c~ 3 directories, 8 files do a refresh to update the patch control - this is kind of like a commit to the patch $ quilt refresh Refreshed patch mypatch.patch see the quilt file tree again tree -L 4 -Ra . ├── patches │ ├── mypatch.patch │ └── series ├── .pc │ ├── applied-patches │ ├── mypatch.patch │ │ ├── source.c │ │ └── .timestamp │ ├── .quilt_patches │ ├── .quilt_series │ └── .version ├── source.c └── source.c~ 3 directories, 10 files now pop (undo) the patch $ quilt pop Removing patch mypatch.patch Restoring source.c No patches applied see the edit is removed $ quilt diff No patches applied $ cat source.c ... now push (re-apply) the patch $ quilt push Applying patch mypatch.patch patching file source.c Now at patch mypatch.patch see the edit is restored $ cat source.c ... get a list of applied patches $ quilt applied mypatch.patch what's in my patch? just a diff $ cat patches/mypatch.patch Index: QUILTTEST/source.c =================================================================== --- QUILTTEST.orig/source.c 2016-12-19 15:43:58.075552604 -0700 +++ QUILTTEST/source.c 2016-12-19 15:57:09.751519885 -0700 @@ -1 +1,2 @@ #define ATHING +#define ADDEDTHING see a list of patches that affect my file $ quilt patches source.c mypatch.patch detach the file from this patch, note edit is gone $ quilt remove source.c File source.c removed from patch mypatch.patch $ quilt diff delete patch $ quilt delete mypatch.patch Patch mypatch.patch appears to be empty, removing No patches applied Removed patch mypatch.patch There's a lot more you can do including removing all applied patches, importing patches etc. |