Online Book Reader

Home Category

Mercurial_ The Definitive Guide - Bryan O'Sullivan [108]

By Root 981 0
to be practical.

* * *

To get going, it’s best to already have a functioning copy of Mercurial installed.

* * *

Warning


If you follow the instructions below, you’ll be replacing and overwriting any existing installation of Mercurial that you might already have, using the latest “bleeding edge” Mercurial code. Don’t say you weren’t warned!

* * *

Clone the Python inotify binding repository. Build and install it.hg clone http://hg.kublai.com/python/inotify

cd inotify

python setup.py build --force

sudo python setup.py install --skip-build

Clone the crew Mercurial repository. Clone the inotify patch repository so that Mercurial Queues will be able to apply patches to your copy of the crew repository.hg clone http://hg.intevation.org/mercurial/crew

hg clone crew inotify

hg clone http://hg.kublai.com/mercurial/patches/inotify inotify/.hg/patches

Make sure that you have the Mercurial Queues extension, mq, enabled. If you’ve never used MQ, read Getting Started with Mercurial Queues to get started quickly.

Go into the inotify repo, and apply all of the inotify patches using the hg -a option to the qpush command.cd inotify

hg qpush -a

If you get an error message from qpush, you should not continue. Instead, ask for help.

Build and install the patched version of Mercurial.python setup.py build --force

sudo python setup.py install --skip-build

Once you’ve built a suitably patched version of Mercurial, all you need to do to enable the inotify extension is add an entry to your ~/.hgrc.

[extensions] inotify =

When the inotify extension is enabled, Mercurial will automatically and transparently start the status daemon the first time you run a command that needs status in a repository. It runs one status daemon per repository.

The status daemon is started silently, and runs in the background. If you look at a list of running processes after you’ve enabled the inotify extension and run a few commands in different repositories, you’ll thus see a few hg processes sitting around, waiting for updates from the kernel and queries from Mercurial.

The first time you run a Mercurial command in a repository when you have the inotify extension enabled, it will run with about the same performance as a normal Mercurial command. This is because the status daemon needs to perform a normal status scan so that it has a baseline against which to apply later updates from the kernel. However, every subsequent command that does any kind of status check should be noticeably faster on repositories of even fairly modest size. Better yet, the bigger your repository is, the greater performance advantage you’ll see. The inotify daemon makes status operations almost instantaneous on repositories of all sizes!

If you like, you can manually start a status daemon using the inserve command. This gives you slightly finer control over how the daemon ought to run. This command will of course only be available when the inotify extension is enabled.

When you’re using the inotify extension, you should notice no difference at all in Mercurial’s behavior, with the sole exception of status-related commands running a whole lot faster than they used to. You should specifically expect that commands will not print different output, neither should they give different results. If either of these situations occurs, please report a bug.

Flexible Diff Support with the extdiff Extension

Mercurial’s built-in hg diff command outputs plain text unified diffs.

$ hg diff

diff -r a6ba002523c0 myfile

--- a/myfile Tue May 05 06:44:37 2009 +0000

+++ b/myfile Tue May 05 06:44:37 2009 +0000

@@ -1,1 +1,2 @@

The first line.

+The second line.

If you would like to use an external tool to display modifications, you’ll want to use the extdiff extension. This will let you use, for example, a graphical diff tool.

The extdiff extension is bundled with Mercurial, so it’s easy to set up. In the extensions section of your ~/.hgrc, simply add a one-line entry to enable the extension.

[extensions]

extdiff =

This introduces

Return Main Page Previous Page Next Page

®Online Book Reader