How Does Mercurial Communicate Changes Between Clients? - mercurial

Forgive me if this question sounds ridiculously naive, but I don't seem to be able to find a straightforward answer to this anywhere.
I am considering using Mercurial for source control on a small (2-3 developers) project. I like the idea of not having to subscribe to a central repository, and I like that everyone effectively has a complete copy of the project. What I don't understand is how the Mercurial clients communicate changes to each other. Does it require opening a specific port or something similar?
Any pointers to help on Mercurial or comments from people who have used it would be gratefully received.

Mercurial can access remote repositories in a number of ways. The main ones are:
File access (i.e. look at the repo at this path)
HTTP / HTTPS (i.e. look at the repo being served at this web address)
SSH (i.e. log into this machine / user, and look at the repo at this path)
The first only really works if your team is all working on a shared file-system, but is also useful if you personally have multiple clones that you want to move information between.
HTTP is how you would access something like Bitbucket, or some other "available to all" server. You can set-up a temporary server on a machine with the command hg serve, and that's useful if you need to share with a colleague quickly and don't care about security, but normally HTTP Mercurial servers sit behind Apache, or some other web server software.
An SSH based set-up is just a machine running an SSH server which has Mercurial installed. Mercurial logs on to the machine, and invokes hg remotely. The local hg and the remote hg then talk over the link. Very easy to set-up in my opinion. Credentials are all handled in normal SSH ways.
Further reading:Publishing Repositories

Related

Mercurial Introduction - BitBucket and 3rd Party Server Issue

I have just started working on a web project that uses Mercurial version control system to a bitbucket account.
The web project is hosted on a 3rd party server - Webfaction.
I have followed all the Mercurial tutorials at Mercurial
The tutorials state that a repository should be made on the local pc and then changes made to the code in the repository on the local pc and then added, committed and pushed to the bitbucket account.
But my project is hosted on a server - WebFaction, so all the code changes should happen on the server, so I can see that the changes work.
I cannot find a reference to changing the code on the WebFaction server (only on the local pc) and then committing and pushing the code from the WebFaction server to the bitbucket account. I simply don't know how to do this (or even if it can be done!).
Can someone give me the steps and syntax (as much as possible) to do this? Could you also keep the answers as simple as possible as there are huge parts of Mercurial I don't yet understand.
Thanks.
Assuming you have full SSH access to the WebFaction server (you should according to the WebFaction features page), I suggest you try following the detailled instructions found here. If you get stuck on any step, then you can ask a more specific question (probably better to ask on serverfault though).
The fact that the repository is on a remote server does not really change anything. You connect through SSH to the remote server (WebFaction) and you follow the steps as if it was a local machine.

Setting up TortoiseHg on a server

I would like to setup tortoisehg on my server. I did it.
I have setup webserver that tortoisehg provide. But I would like to manage users that can use repositories (can read/write) how I can setup users with their password?
I very like this functionality like VisualSVN server does http://www.visualsvn.com/server/. Is it possible to have something similar with tortoisehg?
When I was doing it on a Windows Server 2000, I didn't want to mess with Apache, and ended up using this HOWTO for setting up hg serve behind nginx:
https://www.mercurial-scm.org/wiki/HgServeNginx
The trick here is that you need to run hg serve as a Windows Service. You'll need srvany or something like it for doing that.
This only allows a config where everyone can read, but only authenticated users can push, or, if you remove limit_except GET, where only authenticated users can read and push. More detailed permission schemes require additional setup.

Is system-wide Mercurial installation enough in a shared enviroment?

I am learning how I can install Mercurial on our team system, but I am not experienced enough to make some decision.
For our team, we have a server machine used as a repository. Every team member also has her/his own Linux RedHat installed machine. However, we do not do anything on our local terminals and we do everything on the server. Every member has a user directory on the server such as /home/Cassie, /home/john, ... and we save all our code and work there. When we turn on the local terminals, the GNOME system shows our personal files on the server not the local machine. Whenever everyone click the terminal application on desktop, it connects to her own home directory. Thus, we do not need to use SSH command to connect to the server. It is like the school multi-users system. Everyone has a user account and she logs into her own account to do her own work. I hope I can install a shared repository on that server and every one can do push, pull, etc. all kind of commands there.
1) Since we use a shared environment, does it mean that I need to install Mercurial on only the server and that is enough for everyone to do "commit", "push", "pull", etc. commands?
2) By installing only system-wide Mercurial, does it eliminate the ability to do local commit? If I would like to let everyone still have the "local commit" ability, how should I do it?
3) I have searched online. Some people mentioned that for a shared network server, it is impossible to have locks for any two users if they are trying to access the same file at the same time. Does it imply my situation?
In sum, we do all the work on the server. I hope to find a plan to have Mercurial control on a repository shared by everyone when everyone still has local commit ability and the repository still has some locks protection if any two users try to access a file at the same time. If this scenario is feasible, can I just install the Mercurial on the server or I need to install Mercurial for both servers and users machines? If it is impossible for the scenario, would someone please suggest me a plan to have version control for our system?
1) Since we use a shared environment, does it mean that I just need to install the Mercurial on the server and it is enough for everyone to do "commit","push","pull"..etc commands ?
If your users are logging into a shell on the server in order to do their work, then yes it is sufficient to have Mercurial installed only on the server.
2) By installing only system-wide Mercurial, does it eliminate the ability to do local commit ? If I would like to let everyone still have the "local commit" ability, how should I do it ?
Your users will presumably checkout from a shared "root" repository into their own home directory in order to work on the code. They will have a "local" copy of the repo in their home directory and will push into the shared root repository.
3) I have searched online. Some people mentioned that for a shared network server, it is impossible to have locks for any two users if they are trying to access the same file at the same time. Does it imply my situation ?
As long as your users are working within their own local copies of the repo, they will not interfere with one another. The only time a conflict may arise is when committing back to the shared root repository -- in which case the user will need to merge their changes and resolve any conflicts.
I would recommend reading carefully through Joel Spolsky's excellent Hg Init tutorial for a better understanding of how Mercurial handles "central" and "local" copies.

Need: Version control - install with only ftp/mysql access

I would like to host my own version control on the server I already pay for. I don't have shell access, but I can use ftp (obviously) and mysql. Are there any version control solutions that can run with only these?
I don't think Subversion or CVS will work without software installation. Can you mount your account as a file share/network drive? If so Mercurial would work. You could keep your master repo in the folder and clone it onto your local hard drive for real work. If you're just looking for a remote repository solution, you might be able to use Mercurial or Git with DropBox in the same way.
This is just my opinion, but if any provider ever told me they don't support SSH because of security I would immediately cancel my account and get a new provider. Let me guess: they only do Windows server hosting?
If you need to keep your project private you could always use a paid GitHub or BitBucket account as well, but that doesn't solve the problem of hosting on your existing account.
Straight out of git's man page:
Git natively supports ssh, git, http, https, ftp, ftps, and rsync protocols.
Rsync works over FTP, so you could have a local folder that represents what you want on the host, and then use rsync to deploy it.

How can I host a Mercurial repository for several users myself?

There are a number of hosting services for git, Mercurial, etc. I need to host my own, because some of the data we want to keep there is of a sensitive nature, and we cannot move it off-site.
I need to host a Mercurial repository on a server so that a number of people can access it to both pull changes and push their own work. There needs to be some kind of password protection, and it could also use ssh. I would prefer HTTP(S) as the transfer protocol (a la Google Code) though, if possible.
Can somebody point me to a description of how to do this? I have only found descriptions for hosting single-user repositories and hosting services so far, but nothing about doing the multi-user hosting myself.
Have a look at the PublishingRepositories page on the mercurial site. It will tell you how to set up the hgwebdir.cgi script for serving multiple repos over https.
Once you've configured it, I would recommend adding this to your hgrc:
[web]
style = gitweb
I find it's a bit nicer theme than the default.