hgnested.nclone() 中的 "ui" 参数是什么?

What is "ui" parameter in hgnested.nclone()?

import hgnested

sour = "C:\Users\ADMIN\Documents\mercurial\hgserver"

desti = "D:\Work"
hgnested.nclone(source = sour, dest = desti)

我在这里尝试克隆一个嵌套的存储库 "hgserver",其中还有 5 个存储库。但是我收到了错误,

TypeError: nclone() takes at least 2 arguments (2 given)

然后我在这个 link 查看了 python 的 hgnested 包的源代码,发现 nclone() 方法接受了一个我不接受的参数 "ui"了解要传递的内容。

def nclone(ui, source, dest=None, **opts):

谁能帮帮我。

PS:由于我的声誉很低,我无法为这个问题添加相关标签。例如:hgnested、nclone

如果您想从本地驱动器克隆文件或将文件克隆到本地驱动器,则 Hgnested 不是您想要的。当我阅读他们的 "documentation" 时,几行什么都没有,它只是 Mercurial 的一个小扩展。如果你只想复制一个目录,你应该这样做:

import shutil 
shutil.copytree(sour, desti) # copy dirs 
# use shutil.copy() to copy files

回答您原来的问题,ui 是 Mercurial 的用户界面 class。

Here, ui and repo are the user interface and repository arguments passed into an extension function as standard (see WritingExtensions for more details). If you are not calling the Mercurial command functions from an extension, you will need to create suitable ui and repo objects yourself. The ui object can be instantiated from the ui class in mercurial.ui; the repo object can either be a localrepository, a httprepository, an sshrepository or a statichttprepository (each defined in their own modules), though it will most often be a localrepository.

import hgnested
from mercurial import ui
sour = "C:\Users\ADMIN\Documents\mercurial\hgserver"

desti = "D:\Work"
hgnested.nclone(ui.ui(), source = sour, dest = desti)

如@abccd 所回答,我只需要将我的方法调用更改为上面一行,克隆就成功了。