[wiki] [official] Completed documentation about using MQ with dwm. || f

From: <hg_AT_suckless.org>
Date: Thu, 21 Aug 2008 17:16:16 +0100 (BST)

changeset: 127:a11d7e128211
tag: tip
user: f.e.negroni_AT_gmail.com
date: Thu Aug 21 00:03:12 2008 +0100
files: dwm/customisation/patch_queue.md
description:
Completed documentation about using MQ with dwm.


diff -r cdcacfc6b638 -r a11d7e128211 dwm/customisation/patch_queue.md
--- a/dwm/customisation/patch_queue.md Tue Aug 19 00:04:52 2008 +0100
+++ b/dwm/customisation/patch_queue.md Thu Aug 21 00:03:12 2008 +0100
_AT_@ -194,4 +194,171 @@
 
 ###Update to the latest dwm source
 
-To be continued...
+This is where MQ shines.
+
+We now must remove all our customisations (the entire queue of applied patches). This will bring our repository (not just the working copy, but our entire history) back to where we started. To prove it, let's look at the current tip of our history:
+
+ $ hg log -r tip
+ changeset: 1340:6a95ea4eed06
+ tag: tip
+ tag: mfact_05
+ tag: qtip
+ user: f.e.negroni
+ date: Tue Aug 19 00:00:09 2008 +0100
+ summary: [mq]: mfact_05
+
+That shows that our history has changed since we started working on our patches.
+
+Let's remove all the applied patches:
+
+ $ hg qpop -a
+ Patch queue now empty
+
+The tip of our history has now gone back to where we started:
+
+ $ hg log -r tip
+ changeset: 1337:c4ecef7983b8
+ tag: tip
+ user: Anselm R Garbe
+ date: Mon Aug 18 19:28:57 2008 +0100
+ summary: Martin Hurtons typo fix
+
+To get the latest code we must remember how we obtained the code.
+
+If we cloned the official repository and updated our working copy to tag 5.1, we can simply do:
+
+ $ hg pull
+ $ hg up -r tip
+
+We will be informed that some files had to be updated. Remember that our patches were based on a working copy of tag 5.1
+
+If we obtained the source from a tarball, we might need to download a more recent tarball, extract the tarball on top of our working copy and resync our repository:
+
+ $ hg addremove
+ $ hg ci -m 'synched with latest code'
+
+###Apply our customisations again
+
+Our customisations are not lost: they are safe in `.hg/patches`. They are just not applied to the current working copy.
+
+To do that, issue this command:
+
+ $ hg qpush -a
+
+This will apply our patches, one by one, in the order they were created.
+
+ $ hg qpush -a
+ applying install_location
+ applying configh_dep
+ applying mfact_05
+ patching file config.def.h
+ Hunk #1 FAILED at 22
+ 1 out of 1 hunk FAILED -- saving rejects to file config.def.h.rej
+ patch failed, unable to continue (try -v)
+ patch failed, rejects left in working dir
+ Errors during apply, please fix and refresh mfact_05
+
+If our customisations can be applied, they will be. But as you can see, our customisation `mfact_05` did not succeed.
+
+MQ has successfully applied `install_location` and `configh_dep`, but encountered a problem in `mfact_05`. What it is now telling us is that we can look at the conflict in `config.def.h.rej` and try and fix the problem.
+
+This is `config.def.h.rej`:
+
+ --- config.def.h
+ +++ config.def.h
+ _AT_@ -23,7 +23,7 @@
+ };
+
+ /* layout(s) */
+ -static float mfact = 0.55;
+ +static float mfact = 0.5;
+ static Bool resizehints = True; /* False means respect size hints in tiled resizals */
+
+That's the change we created and saved in our patch queue.
+
+If we look at `config.def.h` now, we can try and fix our patch. We know from the rejects file above that `mfact` was not modified.
+
+The section in `config.def.h` that we originally modified had work done to it between tag 5.1 and the tip. It now looks like this:
+
+ /* layout(s) */
+ static float mfact = 0.55; /* factor of master area size [0.05..0.95] */
+ static Bool resizehints = True; /* False means respect size hints in tiled resizals */
+
+So some comments were added.
+
+What we do now is simple: change mfact and refresh our current MQ patch. We know our current MQ patch is `mfact_05` because that's where `qpush` left off.
+
+After changing `config.def.h`, simply do:
+
+ $ hg qrefresh
+
+And the patch queue is now updated.
+
+###Patch queue history
+
+When we refresh our patch with `qrefresh`, we do not automatically commit to our patch queue repository in `.hg/patches`.
+
+This is where we can take advantage of MQ for our customisation.
+
+We know that the customisations we created for dwm version 5.1 are correct. They just fail to apply to the latest source tree.
+
+ $ cd .hg/patches
+ $ hg stat
+ M mfact_05
+ $ hg log -r tip
+ changeset: 2:d57a0f67f9a5
+ tag: tip
+ user: f.e.negroni
+ date: Tue Aug 19 00:00:20 2008 +0100
+ summary: Our mfact is now 0.5
+
+So, we can mark that fact in our patch queue repository:
+
+ $ hg tag 5.1
+ $ hg tags
+ $ hg tags
+ tip 3:c199ba305efd
+ 5.1 2:d57a0f67f9a5
+
+And now we can commit our latest `mfact_05` to our patch queue so it is safe:
+
+ $ hg ci -m 'mfact_05 refreshed for dwm changeset:1337'
+ $ hg log
+ changeset: 4:b50744a3fb9e
+ tag: tip
+ user: f.e.negroni
+ date: Wed Aug 20 23:58:06 2008 +0100
+ summary: mfact_05 refreshed for dwm changeset:1337
+
+ changeset: 3:c199ba305efd
+ user: f.e.negroni
+ date: Wed Aug 20 23:55:02 2008 +0100
+ summary: Added tag 5.1 for changeset d57a0f67f9a5
+
+ changeset: 2:d57a0f67f9a5
+ tag: 5.1
+ user: f.e.negroni
+ date: Tue Aug 19 00:00:20 2008 +0100
+ summary: Our mfact is now 0.5
+
+ changeset: 1:dd93da2d71d3
+ user: f.e.negroni
+ date: Mon Aug 18 23:42:26 2008 +0100
+ summary: Made config.h depend on config.def.h
+
+ changeset: 0:b0fed54a0021
+ user: f.e.negroni
+ date: Mon Aug 18 23:30:30 2008 +0100
+ summary: First patch to installation target
+
+###Let's share our customisations with others
+
+If anyone is interested in our customisations, they can simply clone our patch queue repository, the one in `.hg/patches`.
+
+Since `.hg/patches` is simply another mercurial repository, we can share it in a number of ways, like exporting it or making it available through ssh or http.
+
+The big bonus is that now, whomever clones our customisations, will receive our customisations not for just one version of dwm, but for any version that we tagged in our repository.
+
+This is extremely helpful to make sure the correct patch is applied to the correct source.
+
+##The End
Received on Thu Aug 21 2008 - 18:16:16 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:30:24 CEST