Online Book Reader

Home Category

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

By Root 909 0
the newly committed changeset.

See also: precommit (precommit—Before Starting to Commit a Changeset)

preupdate—Before Updating or Merging Working Directory

This controlling hook is run before an update or merge of the working directory begins. It is run only if Mercurial’s normal pre-update checks determine that the update or merge can proceed. If the hook succeeds, the update or merge may proceed; if it fails, the update or merge does not start.

Parameters to this hook:

parent1: A changeset ID. The ID of the parent that the working directory is to be updated to. If the working directory is being merged, it will not change this parent.

parent2: A changeset ID. Only set if the working directory is being merged. The ID of the revision that the working directory is being merged with.

See also: update (update—After Updating or Merging Working Directory)

tag—After Tagging a Changeset

This hook is run after a tag has been created.

Parameters to this hook:

local: A boolean. Whether the new tag is local to this repository instance (i.e., stored in .hg/localtags) or managed by Mercurial (stored in .hgtags).

node: A changeset ID. The ID of the changeset that was tagged.

tag: A string. The name of the tag that was created.

If the created tag is revision-controlled, the commit hook (see commit—After a New Changeset Is Created) is run before this hook.

See also: pretag (pretag—Before Tagging a Changeset)

update—After Updating or Merging Working Directory

This hook is run after an update or merge of the working directory completes. Since a merge can fail (if the external hgmerge command fails to resolve conflicts in a file), this hook communicates whether the update or merge completed cleanly.

error: A boolean. Indicates whether the update or merge completed successfully.

parent1: A changeset ID. The ID of the parent that the working directory was updated to. If the working directory was merged, it will not have changed this parent.

parent2: A changeset ID. Only set if the working directory was merged. The ID of the revision that the working directory was merged with.

See also: preupdate (preupdate—Before Updating or Merging Working Directory)

Chapter 11. Customizing the Output of Mercurial

Mercurial provides a powerful mechanism to let you control how it displays information. The mechanism is based on templates. You can use templates to generate specific output for a single command, or to customize the entire appearance of the built-in web interface.

Using Precanned Output Styles

Packaged with Mercurial are some output styles that you can use immediately. A style is simply a precanned template that someone wrote and installed somewhere that Mercurial can find.

Before we take a look at Mercurial’s bundled styles, let’s review its normal output.

$ hg log -r1

changeset: 1:59ae2fd35d8a

tag: mytag

user: Bryan O'Sullivan

date: Tue May 05 06:44:45 2009 +0000

summary: added line to end of <> file.

This is somewhat informative, but it takes up a lot of space—five lines of output per changeset. The compact style reduces this to three lines, presented in a sparse manner.

$ hg log --style compact

3[tip] 4b984b80759d 2009-05-05 06:44 +0000 bos

Added tag v0.1 for changeset cefd14841d41

2[v0.1] cefd14841d41 2009-05-05 06:44 +0000 bos

Added tag mytag for changeset 59ae2fd35d8a

1[mytag] 59ae2fd35d8a 2009-05-05 06:44 +0000 bos

added line to end of <> file.

0 6ed500684dd0 2009-05-05 06:44 +0000 bos

added hello

The changelog style hints at the expressive power of Mercurial’s templating engine. This style attempts to follow the GNU Project’s changelog guidelines.

$ hg log --style changelog

2009-05-05 Bryan O'Sullivan

* .hgtags:

Added tag v0.1 for changeset cefd14841d41

[4b984b80759d] [tip]

* .hgtags:

Added tag mytag for changeset 59ae2fd35d8a

[cefd14841d41] [v0.1]

* goodbye, hello:

added line to end of <> file.

in addition, added a file with the helpful name (at least

Return Main Page Previous Page Next Page

®Online Book Reader