Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating new repositories using mercurial-server

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.

like image 910
zerkms Avatar asked May 04 '11 02:05

zerkms


People also ask

How do I create a Mercurial repository?

Create a local Mercurial repository Open the project you want to store in a repository. From the main menu, choose Hg | Create Mercurial Repository. Specify the location of the new repository.

What is a Mercurial repository?

Strictly speaking, the term repository refers to the directory named . hg (dot hg) in the repository root directory. The repository root directory is the parent directory of the . hg directory. Mercurial stores its internal data structures – the metadata – inside that .

How do I fork a repository on Mercurial?

Forking is as simple as cloning the repo. When it comes to creating the fork on your server, that depends on the software your server runs - especially if you have no access to the server... a login would greatly help. Otherwise make sure that you have the server run a software like kallithea.


1 Answers

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.

like image 131
Christophe Muller Avatar answered Oct 24 '22 07:10

Christophe Muller