deeb
deeb

Reputation: 1382

Mercurial API: hg.repository with https

I'm trying to write a simple script that clones an existing Mercurial kiln repository that uses https authentications. I have this snippet:

from mercurial import hg, ui

repo = hg.repository(ui.ui(), "https://something.kilnhg.com/...")

Normally, whenever I would clone this repo or something, Mercurial would ask me to authenticate myself with a username and password. Instead, the above snippet just isn't getting authorized and gives me this error:

[a bunch of tracebacks...]
  File "C:\Python26\lib\site-packages\mercurial\url.py", line 131, in find_user_password
    raise util.Abort(_('http authorization required'))
mercurial.error.Abort: http authorization required

How can I pass my username and password to the hg.repository function? I've looked at both the source to hg.py and ui.py, but neither were helpful.

Upvotes: 1

Views: 842

Answers (1)

esamatti
esamatti

Reputation: 18953

You could try setting those directly to the url.

https://username:[email protected]/...

Upvotes: 4

Related Questions