Question

I am on Windows 7 - Sourcetree 1.4.1.0 - Embedded Mercurial 2.6.1

Target is a private mercurial repo hosted on bitbucket.

How do I enable SSH compression so that my transactions are faster?

Was it helpful?

Solution

A quick Google search yielded this document:

Edit the Mercurial global configuration file (~/.hgrc). Add the following line to the UI section:

ssh = ssh -C

When you are done the file should look similar to the following:

[ui]
# Name data to appear in commits
username = Mary Anthony <manthony@atlassian.com>
ssh = ssh -C

On Windows, the Mercurial settings file is located here:

C:\Users\{username}\AppData\Local\Atlassian\SourceTree\hg_local\Mercurial.ini

The contents of the file are actually not to be changed, as its header explains:

; System-wide Mercurial config file.
;
; !!!  Do Not Edit This File !!!
;
; This file will be replaced by the installer on every upgrade.
; Editing this file can cause strange side effects on Vista.
;
; http://bitbucket.org/tortoisehg/stable/issue/135
;
; To change settings you see in this file, override (or enable) them in
; your user Mercurial.ini file, where USERNAME is your Windows user name:
;
; XP or older    - C:\Documents and Settings\USERNAME\Mercurial.ini
; Vista or later - C:\Users\USERNAME\Mercurial.ini

I don't have a Mac, so I can't test this, but this Atlassian answer states that the location of this file for Mac is:

/Applications/SourceTree.app/Contents/Resources/mercurial_local/hg_local/

OTHER TIPS

In my case, I'm using TortoiseHg, but the concept should be the same.

Here is my original c:\somerepo\.hg\hgrc file:

[paths]
default = ssh://hg@bitbucket.org/someuser/somerepo

So what's happening with ssh? Let's debug a pull statement, hg pull --debug on the command-line. I noticed it is running C:\Program Files\TortoiseHg\lib\TortoisePlink.exe instead of ssh to make the call:

PS C:\somerepo> hg pull --debug
pulling from ssh://hg@bitbucket.org/someuser/somerepo
running "C:\Program Files\TortoiseHg\lib\TortoisePlink.exe" -ssh -2 hg@bitbucket.org "hg -R someuser/somerepo serve --stdio"
sending hello command
sending between command
abort: no suitable response from remote hg!

So let's just reuse the call, add compression (yay!), non-interactive (batch) and our key:

[paths]
default = ssh://hg@bitbucket.org/someuser/somerepo

[ui]
ssh = "C:\Program Files\TortoiseHg\lib\TortoisePlink.exe" -ssh -2 -C -batch -i "c:\keys\somekey.ppk"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top