Authentification
Authentification is required for some remote command : push, clone, pull.
For these commands, you can add the <auth> nested element.
The mercurial keyring extension allow to automate scripts without prompting the password.
Auth nested element
| Attribute | Description | Value | Required |
|---|---|---|---|
| mode | auth mode | auth*|keyring | no, auth by default (user + password) |
| user | user login | yes | |
| password | user password | for auth mode |
<hg cmd="push" destination="http://mercurial.intuxication.org/hg/ant4hg-tests">
<auth user="ant4hg" password="******" />
</hg>
Mercurial keyring
Mercurial_keyring extension save user passwords and avoid them to prompt password in automated ant scripts.
Installation and configuration
see: mercurial_keyring
$ apt-get install python-pip
$ easy_install keyring
$ easy_install mercurial_keyring
$ cat <<'EOF' > /etc/mercurial/hgrc
[extensions]
mercurial_keyring =
EOF
$ cd my/local/hg/repository
$ hg push http://<user>@repo.com/ant4hg/ant4hg-test
pushing to http://<user>@repo.com/ant4hg/ant4hg-test
searching for changes
http authorization required
realm: Restricted
user: <user> (fixed in .hg/hgrc)
password:
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
<hg cmd="push" destination="http://mercurial.intuxication.org/hg/ant4hg-tests">
<auth user="ant4hg" mode="keyring" />
</hg>