This extension is not distributed with Mercurial.
Author: Ryan Seto
Mercurial Remote Sync (hg-rsync) provides some methods to your working directory in sync with remote files, that exist outside of the repository.
Currently only supports WinSCP.
Configure your .hgrc or mercurial.ini to enable the extension by adding the following lines:
[extensions] rsync = /path/to/hg-rsync
All of hg-rsync's configuration are set under [rsync].
Here is an example:
[rsync] script = sync/winscp.txt path = ssh://email@example.com:22/remote/path/to/sync #Optional cmd = /path/to/winscp.exe #Optional
The script file that will be used by WinSCP.
This can be the relative path from the base directory of your local repository or an absolute path.
See WinSCP's scripting documentation for details on how to write this script.
hg-rsync makes two parameters available from within the script.
The connection portion of the path configuration.
(firstname.lastname@example.org:22 from the example.)
The path portion of the path configuration.
(remote/path/to/sync from the example.)
Here is an example:
option batch on option confirm off option transfer automatic option exclude "readme.txt" open %1% cd %2% synchronize local www/images/upload www/images/upload synchronize local www/files/upload www/files/upload close exit
This will tell WinSCP to do the following:
Open a connection using the login, host, and port specified in the path.
Change to the directory specified in the path.
- Synchronize your several local directories with the remote directories.
This is the remote path to the base directory you want to sync from. By default this will be the default path found under the [paths] portion of your hgrc. You can either specify a full ssh:// path or an alias for a path defined under [paths].
By default, hg-rsync will search for WinSCP in the default install directories. If you have WinSCP elsewhere, then specify where the the executible is with this option.
hg rsync [-s SCRIPT] [PATH]
To use hg-rsync, simply run the following command. This will requires that you at least set the script option and have a default path.
-s SCRIPT, --script SCRIPT
- The path to the WinSCP sync script.
Remote path to sync from. If unspecified this will be the default path. This can be an alias or a full ssh:// path.
You can add a hook to keep your working directory in sync while you work. If you decide to use a hook, make sure you are configured to sync without having to specify a password.
Here is an example that will sync after you Pull changes.
[hooks] postincoming.rsync = python:/path/to/hg-rsync.py:hook