hg.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sun, 07 Nov 2010 22:24:33 +0200
changeset 674 6429d14cfc2a
parent 673 faa365425ff0
child 675 47d4ad70738f
permissions -rw-r--r--
Some Projects that Use Mercurial

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

* About.

    http://mercurial.selenic.com/wiki/ProjectsUsingMercurial
                Some Projects that Use Mercurial

* User config.

Put to your ~/.hgrc:

  [ui]
  ; Editor for editing commit message.
  editor = gvim
  ; Who commit.
  username = Oleksandr Gavenko <gavenkoa@gmail.com>
  ; Use internal merge algorithm, which mark conflict like <<<<<< ====== >>>>>>.
  ; Save previous file version in '*.orig' file, after merge must be marked as
  ; resolved by running 'hg resolve -m <file>'.
  merge = internal:merge
  [web]
  ; Default encoding for file hosted by 'hg serv'.
  encoding = utf-8

** Useful extension.

Put to your ~/.hgrc:

  [extensions]
  ; To allow fetch command.
  fetch =
  ; To allow Mercurial Queues.
  hgext.mq =

** 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

** Follow history ever when file copied.

By default 'hg log' show only history after last file copy. To see log message
before copying run:

  $ hg log -f

or put into ~/.hgrc:

  [defaults]
  log = -f

* Publishing config.

  http://mercurial.selenic.com/wiki/PublishingRepositories
                Publishing Mercurial Repositories

* 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

* Proxy.

  $ hg clone --config http_proxy.host=$host:$port \
    --config http_proxy.user=$user --config http_proxy.passwd=$password  $addr

* Free Mercurial hosting.

  http://mercurial.selenic.com/wiki/MercurialHosting
                Free Hosting of Mercurial Repositories