Question

Using "raw" mercurial API I can write just something like:

peer = hg.peer(ui.ui(), {}, 'ssh://hg@bitbucket.org/some/project')

After the connection is established, I can work with remote repo.

I'm failing to understand what should work with a remote repo using hglib. Naïve approach, i.e. using something just as simple as:

hglib.open("ssh://hg@bitbucket.org/some/project")

does not work, and the exception raised does not make anything clearer to me.

My question: With hglib, how can I open connection to a remote ssh-repo?

No correct solution

OTHER TIPS

The hglib documentation is not very wordy about how to use it. The best is to already have your key copied and RSA fingerprint in your ~/.ssh/known_hosts.

But you can clone a repo with:

hglib.clone(source="ssh://hg@bitbucket.org/some/project")

You can of course add destination folder (e.g. dest="/path/to/blah").

If you already have an existing hg repo cloned you can change some settings in your hgrc before trying hglib.open(), so hg uses the ssh url like so:

[ui]
username = some_user

[paths]
default = ssh://hg@bitbucket.org/some/project

EDIT I think for hg.open to work, you have to have a repo checked out. For me I refer to the path where my repo is cloned. So:

hglib.open('/path/to/cloned/repo')

To do this over SSH you have to edit your /repopath/.hg/hgrc as mentioned above.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top