Online Book Reader

Home Category

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

By Root 941 0
is invoked before Mercurial knows the identities of the changesets to be transmitted.

One use for this hook is to prevent changes from being transmitted to another repository.

Parameters to this hook:

source: A string. The source of the operation that is attempting to obtain changes from this repository (see Sources of changesets). See the documentation for the source parameter to the outgoing hook (in outgoing—After Changesets Are Propagated) for possible values of this parameter.

url: A URL. The location of the remote repository, if known. See Where changes are going—remote repository URLs for more information.

See also: outgoing (outgoing—After Changesets Are Propagated)

pretag—Before Tagging a Changeset

This controlling hook is run before a tag is created. If the hook succeeds, creation of the tag proceeds. If the hook fails, the tag is not created.

Parameters to this hook:

local: A boolean. Whether the 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 to be tagged.

tag: A string. The name of the tag to be created.

If the tag to be created is revision-controlled, the precommit and pretxncommit hooks (commit—After a New Changeset Is Created and pretxncommit—Before Completing Commit of New Changeset) will also be run.

See also: tag (tag—After Tagging a Changeset)

pretxnchangegroup—Before Completing Addition of Remote Changesets

This controlling hook is run before a transaction—that manages the addition of a group of new changesets from outside the repository—completes. If the hook succeeds, the transaction completes, and all of the changesets become permanent within this repository. If the hook fails, the transaction is rolled back, and the data for the changesets is erased.

This hook can access the metadata associated with the almost-added changesets, but it should not do anything permanent with this data. It must also not modify the working directory.

While this hook is running, if other Mercurial processes access this repository, they will be able to see the almost-added changesets as if they were permanent. This may lead to race conditions if you do not take steps to avoid them.

This hook can be used to automatically vet a group of changesets. If the hook fails, all of the changesets are “rejected” when the transaction rolls back.

Parameters to this hook:

node: A changeset ID. The changeset ID of the first changeset in the group that was added. All changesets between this and tip, inclusive, were added by a single hg pull, hg push, or hg unbundle.

source: A string. The source of these changes. See Sources of changesets for details.

url: A URL. The location of the remote repository, if known. See Where changes are going—remote repository URLs for more information.

See also: changegroup (changegroup—After Remote Changesets Added), incoming (incoming—After One Remote Changeset Is Added), prechangegroup (prechangegroup—Before Starting to Add Remote Changesets)

pretxncommit—Before Completing Commit of New Changeset

This controlling hook is run before a transaction—that manages a new commit—completes. If the hook succeeds, the transaction completes and the changeset becomes permanent within this repository. If the hook fails, the transaction is rolled back, and the commit data is erased.

This hook can access the metadata associated with the almost-new changeset, but it should not do anything permanent with this data. It also must not modify the working directory.

While this hook is running, if other Mercurial processes access this repository, they will be able to see the almost-new changeset as if it were permanent. This may lead to race conditions if you do not take steps to avoid them.

Parameters to this hook:

node: A changeset ID. The changeset ID of the newly committed changeset.

parent1: A changeset ID. The changeset ID of the first parent of the newly committed changeset.

parent2: A changeset ID. The changeset ID of the second parent of

Return Main Page Previous Page Next Page

®Online Book Reader