Manage patches with MQ.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 27 Jan 2010 22:33:12 +0200
changeset 294 07d8d2e527df
parent 293 69ddc7efeb14
child 295 d3f8534dadf9
Manage patches with MQ.
hg.rst
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hg.rst	Wed Jan 27 22:33:12 2010 +0200
@@ -0,0 +1,76 @@
+-*- mode: outline; coding: utf-8 -*-
+
+* Manage patches with MQ.
+
+First enable MQ, add following to your ~/.hgrc:
+
+  [extensions]
+  hgext.mq =
+
+Second get unpatched sources and put it to hg repository:
+
+  $ tar zxf proj-x.y.z.tar.gz
+  $ mv proj-x.y.z proj
+  $ cd proj
+  $ hg init
+  $ hg ci -m "Added x.y.z version of proj."
+
+Init MQ and take name for first patch:
+
+  $ hg qinit
+  $ hg qnew first.patch
+
+Next make changes by editing source and save it to patch:
+
+  $ $EDITOR file.c
+  ...
+  $ hg diff
+  ...
+  $ hg qrefresh
+  $ hg diff      # <-- have zero diff
+
+You can make second patch by applying existing one:
+
+  $ hg qnew second.patch
+  $ patch -p1 <bugfix.patch
+  $ hg qrefresh
+
+You can take list of patches (from old to new) and revert or apply patches by
+qpop/qpush command:
+
+  $ hg qseries   # <-- what patches have
+  first.patch
+  second.patch
+  $ hg qapplied  # <-- what patches applied
+  first.patch
+  second.patch
+  $ hg qpop
+  $ hg qseries
+  first.patch
+  second.patch
+  $ hg qapplied
+  first.patch
+
+You can revert or apply all patches by single command:
+
+  $ hg qpop -a
+  $ hg qpush -a
+
+You can delete patch from patch list (before that you need de-apply patch):
+
+  $ hg qpop -a
+  $ hg qdelete first.patch
+
+To add new version of source and fix patches for it first de apply patches,
+then pull new changes and try apply patches on top of new sources:
+
+  $ hg qpop -a
+  $ rm *       # .hg dir not deleted because its name start with dot
+  $ cd ..
+  $ tar zxf proj-a.b.c.tar.gz
+  $ cp -R proj-a.b.c/* proj
+  $ cd proj
+  $ hg addremove -s 70
+  $ hg ci -m "Added a.b.c version of proj."
+  $ hg qpush -a
+