Home > programming > Using Mercurial on Win32

Using Mercurial on Win32

June 28th, 2007

I have set up a mercurial publish server for a group recently. All members in this group use Windows.
The server is accessed via ssh, and the ssh server listen on a port other than 22. With google’s help, I found a lot of documents about how to setup mercurial with putty (plink). But things go wrong when you’re not using port 22…
Openssh uses “-p” to specify server port to connect to, but plink uses “-P” instead. Mercurial fails with

remote: plink: unknown option “-p”

when it invokes ssh.
With a small modification, mercurial should work fine with plink. Or you can specify the server port in mercurial.ini instead of in URL.

jesse programming

  1. jeul
    December 22nd, 2007 at 00:04 | #1

    With what modification will mercurial work with plink? I have try to google the solution, and this artical was found.

  2. December 25th, 2007 at 12:01 | #2

    For a ssh server on port 22, mercurial should work fine with plink. No modification is needed. You can ask mercurial to use plink as ssh command in the mercurial.ini.
    If you’re dealing with a ssh server on a port other thabn 22, you can either modify mercurial to use ‘-P’ instead of ‘-p’, or tell mercurial to use ‘plink -P xxx’ as the ssh command. Even more, You can use a batch file wrapper to do this.

  3. jeul
    December 28th, 2007 at 22:23 | #3

    There are 3 methods from your reply,
    1) modify mercurial to use ‘-P’ instead of ‘-p’
    2) tell mercurial to use ‘plink -P xxx’
    3) use a batch file wrapper

    For method 1), did you mean to modify the mercurial source and recompile it?

    For method 2), it is proper for different external repositories with different ssh ports.

    For method 3), …… hummm …, may be some other day, I could write a proper batch file that can parse the ‘-p’ parameter.

  4. jesse
    December 31st, 2007 at 11:56 | #4

    Hi jeul,
    for (1), yes, what i mean is modifying the source. No recompilation is needed since it’s written in python. :) But
    for (2), just ask mercurial to use ‘plink -P xxx’ in mercurial.ini. But you have to modify the ini file everytime you want to connect to a different port…
    So (3) should be the solution in my opinion.

  1. No trackbacks yet.