hg.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Fri, 26 Feb 2010 23:45:00 +0200
changeset 310 4af75f7ab947
parent 295 d3f8534dadf9
child 311 e3d3fd4c128b
permissions -rw-r--r--
Multiline log message for log command.

-*- mode: outline; coding: utf-8 -*-

* Useful customization.

** Multiline log message for log command.

By default 'hg log' show only first line of log message. To see all message run:

  $ hg log -v

or put into ~/.hgrc:

  [defaults]
  log = -v

* 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

To apply series of already done patches use:

  $ ls /path/to/bugfixes/*.patch | xargs hg qimport