使用 Mercurial-server 创建新存储库

发布于 2024-11-04 22:05:24 字数 1251 浏览 0 评论 0原文

根据 http://dev.lshift.net/paul 上的“创建存储库” /mercurial-server/docbook.html 创建新存储库所需要做的就是克隆不存在的存储库。

但在 1.1 中我不起作用。如果我们看一下代码:

if cmd is None:
    fail("direct logins on the hg account prohibited")
elif cmd.startswith('hg -R ') and cmd.endswith(' serve --stdio'):
    repo = getrepo("read", cmd[6:-14])
    if not os.path.isdir(repo + "/.hg"):
        fail("no such repository %s" % repo)
    dispatch.dispatch(['-R', repo, 'serve', '--stdio'])
elif cmd.startswith('hg init '):
    repo = getrepo("init", cmd[8:])
    if os.path.exists(repo):
        fail("%s exists" % repo)
    d = os.path.dirname(repo)
    if d != "" and not os.path.isdir(d):
        os.makedirs(d)
    dispatch.dispatch(['init', repo])
else:
    fail("illegal command %r" % cmd)

我们可以看到,要创建我们需要专门传递 init 命令。

该命令按预期工作:

"TortoisePlink.exe" -ssh -2 hg@mercurial "hg init tst"

但我希望这是一些更优雅的命令。

好吧,这是文档中的“错误”还是我做错了什么?

更新

我的问题只是关于使用mercurial-server远程创建存储库。

更新2

这是我的误解,因为我不清楚应该已经创建了本地存储库,该存储库将被远程克隆。

According to the "Creating repositories" at http://dev.lshift.net/paul/mercurial-server/docbook.html all we need to do to create new repository - is to clone not existent one.

But in 1.1 I doesn't work. And if we look at code:

if cmd is None:
    fail("direct logins on the hg account prohibited")
elif cmd.startswith('hg -R ') and cmd.endswith(' serve --stdio'):
    repo = getrepo("read", cmd[6:-14])
    if not os.path.isdir(repo + "/.hg"):
        fail("no such repository %s" % repo)
    dispatch.dispatch(['-R', repo, 'serve', '--stdio'])
elif cmd.startswith('hg init '):
    repo = getrepo("init", cmd[8:])
    if os.path.exists(repo):
        fail("%s exists" % repo)
    d = os.path.dirname(repo)
    if d != "" and not os.path.isdir(d):
        os.makedirs(d)
    dispatch.dispatch(['init', repo])
else:
    fail("illegal command %r" % cmd)

we can see, that to create we need to pass specifically init command.

This command works as expected:

"TortoisePlink.exe" -ssh -2 hg@mercurial "hg init tst"

but I hope it is some more elegant command to do so.

Well, is it a "bug" in documentation or am I doing something wrong?

UPDATE:

My question is only about creating repositories remotely using mercurial-server.

UPDATE 2:

It was my misunderstanding, since it was not clear for me that there should be already created local repository, that will be cloned remotely.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

往事风中埋 2024-11-11 22:05:24

我发现使用 Mercurial-server 创建新的存储库非常简单。假设您拥有权限并且路径“/dir1/dir2/”已存在于服务器上,只需(使用命令行):

mkdir new
cd new
hg init
hg clone . ssh://hg@server/dir1/dir2/new

干杯,
克里斯托夫.

I find it very straightforward to create a new repo using Mercurial-server. Assuming that you have the rights and that the path "/dir1/dir2/" already exist on the server, simply (using command line):

mkdir new
cd new
hg init
hg clone . ssh://hg@server/dir1/dir2/new

Cheers,
Christophe.

零度℉ 2024-11-11 22:05:24

您引用的页面用于共享现有存储库,而不是专门用于创建新的空存储库。您给出的命令 hg init tst 对于初始化新的空存储库是正确的。我认为唯一“不优雅”的事情是你是远程执行的,因此需要提供额外的 ssh 命令。存储库创建命令本身 hg init 非常简单。

The page you reference is for sharing existing repositories, not specifically for creating new, empty ones. The command you give hg init tst is correct for initializing a new, empty repository. I think the only 'inelegant' thing about it is that you are doing it remotely and thus need to give the additional ssh commands. The repository creation command itself hg init is quite simple.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文