Mercurial OnRemote Extension
Project description
Execute some Mercurial command on remote repository (ssh/local repositories only).
1 Example
My two main use cases:
update remote directory after pushing:
hg push staging hg onremote staging update -r tip
check status and possibly commit in remote directory:
hg onremote rhdevel status hg onremote rhdevel commit -m 'Forgotten typo'
In those examples staging and rhdevel are remote paths, mapped to urls like ssh://some.machine.net/repos/myrepo (local paths work too).
Explicit path works too, but is much less handy:
hg onremote ssh://euler.mydev.net/repos/myrepo status
2 Arguments
General command syntax:
hg onremote «remote» «command» «arguments»
where «remote» is remote repository alias or path, and remaining arguments constitute normal mercurial command.
Option --ssh can be used just like with push or pull:
hg onremote --ssh /custom/ssh staging status
3 How does it work
The extension simply resolves the specified path, and:
if it maps to local directory, executes hg --cwd that/directory «command» «arguments»
if it maps to ssh path, executes ssh that/machine hg --cwd that/directory «command» «arguments»
elsewhere (http or other remote) it refuses to work.
There is nothing particularly magical, the extension is intended to save some keystrokes and avoid flow interruption (I wrote it mainly to stop writing various push and update shell scripts).
4 Configuration
There is currently no dedicated configuration.
Standard mercurial settings are used to decide how to call ssh and which remote command to call to spawn Mercurial (see ssh and remotecmd settings in [ui] section). This way onremote uses the same ssh command which is used by hg push and hg pull, and the same mercurial name.
5 Problems and limitations
Interactive commands may fail to work properly due to lack of fully working console. I recommend avoiding commands which trigger interactive prompts or editor spawns. If you try hg onremote commit add -m "Some message".
6 Installation
Mercurial ≥ 3.4 is required (attempts to run on older version will result in crashes) and Mercurial ≥ 4.5 is strongly recommended (versions 3.4-4.4 involve some hacks which may fail for more complicated arguments).
6.1 Linux/Unix (from PyPI)
If you have working pip or easy_install:
pip install --user mercurial_on_remote
or maybe:
sudo pip install mercurial_on_remote
(or use easy_install instead of pip). Then activate by:
[extensions] mercurial_on_remote =
To upgrade, repeat the same command with --upgrade option, for example:
pip install --user --upgrade mercurial_on_remote
6.2 Linux/Unix (from source)
If you don’t have pip, or wish to follow development more closely:
clone both this repository and mercurial_extension_utils and put them in the same directory, for example:
cd ~/sources hg clone https://foss.heptapod.net/mercurial/mercurial-extension_utils/ hg clone https://foss.heptapod.net/mercurial/mercurial-on_remote/
update to newest tags,
activate by:
[extensions] mercurial_on_remote = ~/sources/mercurial-on_remote/mercurial_on_remote.py
To upgrade, pull and update.
See mercurial_extension_utils for longer description of this kind of installation.
6.3 Windows
If you have any Python installed, you may install with pip:
pip install mercurial_on_remote
Still, as Mercurial (whether taken from TortoiseHg, or own package) uses it’s own bundled Python, you must activate by specifying the path:
[extensions] mercurial_on_remote = C:/Python27/Lib/site-packages/mercurial_on_remote.py ;; Or wherever pip installed it
To upgrade to new version:
pip --upgrade mercurial_on_remote
If you don’t have any Python, clone repositories:
cd c:\hgplugins hg clone https://foss.heptapod.net/mercurial/mercurial-extension_utils/ hg clone https://foss.heptapod.net/mercurial/mercurial-on_remote/
update to tagged versions and activate by path:
[extensions] mercurial_on_remote = C:/hgplugins/mercurial-on_remote/mercurial_on_remote.py ;; Or wherever you cloned
See mercurial_extension_utils documentation for more details on Windows installation.
7 History
See HISTORY.rst
8 Repository, bug reports, enhancement suggestions
Development is tracked on HeptaPod, see https://foss.heptapod.net/mercurial/mercurial-on_remote/
Use issue tracker there for bug reports and enhancement suggestions.
Thanks to Octobus and Clever Cloud for hosting this service.
9 Additional notes
Information about this extension is also available on Mercurial Wiki: http://mercurial.selenic.com/wiki/OnRemoteExtension
Check also other Mercurial extensions I wrote.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file mercurial_on_remote-1.0.6.tar.gz
.
File metadata
- Download URL: mercurial_on_remote-1.0.6.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 365c35bf7855f7110d0380d5f65a83f29bd59c7440ddda82f6b40047a6535ca8 |
|
MD5 | 0735a039ffe8b3b488478e234b27be0e |
|
BLAKE2b-256 | 296472176663815f137a5a8426fc7a4bf7c8348ca4534b095a041bb8af8fee1e |