Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Mercurial API:hg.repository和https_Python_Api_Mercurial_Https - Fatal编程技术网

Python Mercurial API:hg.repository和https

Python Mercurial API:hg.repository和https,python,api,mercurial,https,Python,Api,Mercurial,Https,我正在尝试编写一个简单的脚本,用于克隆使用https身份验证的现有Mercurial存储库。我有一段话: from mercurial import hg, ui repo = hg.repository(ui.ui(), "https://something.kilnhg.com/...") 通常,每当我克隆这个回购协议或其他东西时,Mercurial都会要求我用用户名和密码对自己进行身份验证。相反,上面的代码片段没有得到授权,并给了我以下错误: [a bunch of traceback

我正在尝试编写一个简单的脚本,用于克隆使用https身份验证的现有Mercurial存储库。我有一段话:

from mercurial import hg, ui

repo = hg.repository(ui.ui(), "https://something.kilnhg.com/...")
通常,每当我克隆这个回购协议或其他东西时,Mercurial都会要求我用用户名和密码对自己进行身份验证。相反,上面的代码片段没有得到授权,并给了我以下错误:

[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

如何将用户名和密码传递到
hg.repository
函数?我已经查看了hg.py和ui.py的源代码,但两者都没有帮助。

您可以尝试将它们直接设置为url


您可以尝试直接将这些设置为url


我以前试过这个,但它不起作用,因为我的用户名中有一个“@”。我终于明白我应该逃避它。现在开始工作。我以前试过这个,但没有用,因为我的用户名中有一个“@”。我终于明白我应该逃避它。现在工作。