使用 Mercurial-server 创建新存储库
根据 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现使用 Mercurial-server 创建新的存储库非常简单。假设您拥有权限并且路径“/dir1/dir2/”已存在于服务器上,只需(使用命令行):
干杯,
克里斯托夫.
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):
Cheers,
Christophe.
您引用的页面用于共享现有存储库,而不是专门用于创建新的空存储库。您给出的命令
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 itselfhg init
is quite simple.