W3cubDocs

/Ansible

hg - Manages Mercurial (hg) repositories.

Synopsis

Manages Mercurial (hg) repositories. Supports SSH, HTTP/S and local address.

Options

parameter required default choices comments
clone
(added in 2.3)
no yes
  • yes
  • no
If no, do not clone the repository if it does not exist locally.
dest
yes
Absolute path of where the repository should be cloned to. This parameter is required, unless clone and update are set to no
executable
(added in 1.4)
no
Path to hg executable to use. If not supplied, the normal mechanism for resolving binary paths will be used.
force
no no
  • yes
  • no
Discards uncommitted changes. Runs hg update -C. Prior to 1.9, the default was `yes`.
purge
no no
  • yes
  • no
Deletes untracked files. Runs hg purge.
repo
yes
The repository address.
aliases: name
revision
no
Equivalent -r option in hg command which could be the changeset, revision number, branch name or even tag.
aliases: version
update
(added in 2.0)
no yes
  • yes
  • no
If no, do not retrieve new revisions from the origin repository

Examples

# Ensure the current working copy is inside the stable branch and deletes untracked files if any.
- hg: repo=https://bitbucket.org/user/repo1 dest=/home/user/repo1 revision=stable purge=yes

# Example just get information about the repository whether or not it has
# already been cloned locally.
- hg: repo=git://bitbucket.org/user/repo dest=/srv/checkout clone=no update=no

Notes

Note

If the task seems to be hanging, first verify remote host is in known_hosts. SSH will prompt user to authorize the first contact with a remote host. To avoid this prompt, one solution is to add the remote host public key in /etc/ssh/ssh_known_hosts before calling the hg module, with the following command: ssh-keyscan remote_host.com >> /etc/ssh/ssh_known_hosts.

This is a Core Module

For more information on what this means please read Core Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/hg_module.html