tags:

views:

126

answers:

3

Mercurial's website says about creating a project this way:

Create a project and commit

$ hg init (project-directory)
$ cd (project-directory)
$ (add some files)
$ hg add
$ hg commit -m 'Initial commit'

I need a single user, local repository. I assume this does the trick, right? The thing I don't understand is:will it open a server process, or is the hg binary doing all the work each time it is called?

A: 

This pretty much does the trick. But, what server process are you referring to?

Amit
I know for example SVN has a server where everyone is commiting. I just wanted to know if I can just start working and don't worry about the server.
Geo
+6  A: 

The hg binary is doing all the work each time it is called.

hg doesn't really need a server. You can create one really easily using the hg serve command, but that's more for interacting with other people than anything else, and by default it doesn't allow write access.

Mercurial survived for a long time with a server that didn't allow write access. A decentralized VC system really doesn't need one, or at least it's not anywhere near the absolute requirement it would be with a centralized system. Everybody just writes to their local repository and then advertises their changes for other people (like the maintainer of the 'official' tree) to pull.

In fact, even if there is a central server you can push to, you always commit your changes to your local repository before you push them. The push is more like syncing up a database than it is like the commit you would think of if you're used to things like Subversion or Perforce.

Mercurial looks for a directory called .hg in the current directory, or a parent directory, or a parent of the parent, etc... to determine if it's in a Mercurial repository. The hg init command will work for users with no administrative privileges whatsoever.

Omnifarious
+3  A: 

There is no server process, the binary is indeed doing all the work. That's DVCS: You're working locally; your project directory is working directory and repository at the same time.

Until you start sharing your code, there's no server anywhere.

balpha
So there's no additional setting to be done? If I create a project this way, hg will always know that I'm working on a local repository? By the way, will this work on computers where users don't have administrative privilegdes?
Geo
@Geo: Yes and yes. In Mercurial, you *always* work on a local repo. The sharing of code with other people is only syncing of two repositories ("pushing" and "pulling"). You always *first* commit to your own, local repository, and *then* (maybe) push the repo updates somewhere else. As for administrative privileges: Everything is saved in the directory structure below `project-directory`, so as long as you have write access there, you're fine.
balpha