Creating Mercurial User Repositories

  • Revision slug: Creating_Mercurial_User_Repositories
  • Revision title: Creating Mercurial User Repositories
  • Revision id: 52562
  • Created:
  • Creator: Dholbert
  • Is current revision? No
  • Comment /* Creating an Mq Patch Queue Repository */ -- simplified; just said what to put in hgrc, rather than doing a dummy-clone

Revision Content

When working with Mercurial, it is often nice to publish your changes on a server so others can examine and work with them as well. If you have commit access to CVS, you should have an LDAP account, and that should allow you to push to hg.mozilla.org. If you do, you can create clones in the /users directory and share them with others.

Configuring ssh

So you don't need to type your username every time, add these lines to ~/.ssh/config:

Host hg.mozilla.org
User your-hg@username.domain

where 'your-hg@username.domain' is simply your CVS username with the "%" character replaced with the "@" character.

Creating a Repository

It is a relatively easy process to create your own repository. It will be visible via HTTP at http://hg.mozilla.org/users/your-hg_username.domain/my-repo1.

To do this, run the following command. Use the same command regardless of whether you want to clone an existing repository or create a new, empty one.

ssh hg.mozilla.org clone my-repo1

my-repo1 is the name of the new repository you want to create, not the repository you are trying to clone from.

Running the above ssh command will run an interactive script, prompting you to make some choices (about which repository you want to clone from). It is by and large self-explanatory. When the script is finished, ssh will exit. After 5-10 minutes, your repository should appear on http://hg.mozilla.org/users/

Creating an Mq Patch Queue Repository

Here's how to publish an Mq patch-queue repository:

  1. Create a new empty repository (say, "my-repo-patches") on hg.mozilla.org, as directed above.
  2. Verify that the repository is visible at http://hg.mozilla.org/users/your-hg_username.domain/my-repo-patches
  3. Initialize a patch queue, if you haven't already, with hg qinit -c
  4. Create a hgrc for your patch queue (at .hg/patches/.hg/hgrc) with these contents:
[paths]
default = https://hg.mozilla.org/users/your-hg_username.domain/my-repo-patches
default-push = https://hg.mozilla.org/users/your-hg_username.domain/my-repo-patches

See http://www.selenic.com/mercurial/wiki/index.cgi/MqExtension for background on Mq.

Examining Clones Via the Web

It may take a while for your clone to show up because of some caching mechanisms that have been put in place. It should show up pretty quickly though, and you'll be able to browse history via a web interface.

Others can also pull changes via http:

hg clone http://hg.mozilla.org/users/your-hg_username.domain/my-repo1

Pushing Changes

To push changes, use ssh:

hg push ssh://hg.mozilla.org/users/your-hg_username.domain/my-repo1

You may also want to add that path to the repository's hgrc, so you don't have to type it every time. Put something like this in .hg/hgrc:

[paths]
default-push: ssh://hg.mozilla.org/users/your-hg_username.domain/my-repo1

Bogus error message

You will get the following bogus error message each time you ask hg to do anything that requires a command to be sent to the server.

remote: Could not chdir to home directory : No such file or directory

Just ignore it.

Revision Source

<p>
</p><p>When working with <a href="en/Mercurial">Mercurial</a>, it is often nice to publish your changes on a server so others can examine and work with them as well. If you have commit access to CVS, you should have an LDAP account, and that should allow you to push to hg.mozilla.org. If you do, you can create clones in the <code>/users</code> directory and share them with others.
</p>
<h3 name="Configuring_ssh"> Configuring <code>ssh</code> </h3>
<p>So you don't need to type your username every time, add these lines to <code>~/.ssh/config</code>:
</p>
<pre>Host hg.mozilla.org
User your-hg@username.domain
</pre>
<p>where 'your-hg@username.domain' is simply your CVS username with the "%" character replaced with the "@" character.
</p>
<h3 name="Creating_a_Repository"> Creating a Repository </h3>
<p>It is a relatively easy process to create your own repository. It will be visible via HTTP at <code>http://hg.mozilla.org/users/your-hg_username.domain/my-repo1</code>.
</p><p>To do this, run the following command.  Use the same command regardless of whether you want to clone an existing repository or create a new, empty one.
</p>
<pre class="eval">ssh hg.mozilla.org clone my-repo1
</pre>
<p><code>my-repo1</code> is the name of the <b>new repository you want to create</b>, not the repository you are trying to clone from.
</p><p>Running the above ssh command will run an interactive script, prompting you to make some choices (about which repository you want to clone from). It is by and large self-explanatory. When the script is finished, ssh will exit.  After 5-10 minutes, your repository should appear on <code>http://hg.mozilla.org/users/</code>
</p>
<h3 name="Creating_an_Mq_Patch_Queue_Repository"> Creating an Mq Patch Queue Repository </h3>
<p>Here's how to publish an Mq patch-queue repository:
</p>
<ol><li> Create a new empty repository (say, "<code>my-repo-patches</code>") on hg.mozilla.org, as directed above.
</li><li> Verify that the repository is visible at http://hg.mozilla.org/users/your-hg_username.domain/my-repo-patches
</li><li> Initialize a patch queue, if you haven't already, with <code>hg qinit -c</code>
</li><li> Create a hgrc for your patch queue (at <code>.hg/patches/.hg/hgrc</code>) with these contents:
</li></ol>
<pre>[paths]
default = https://hg.mozilla.org/users/your-hg_username.domain/my-repo-patches
default-push = https://hg.mozilla.org/users/your-hg_username.domain/my-repo-patches
</pre>
<p>See http://www.selenic.com/mercurial/wiki/index.cgi/MqExtension for background on Mq.
</p>
<h3 name="Examining_Clones_Via_the_Web"> Examining Clones Via the Web </h3>
<p>It may take a while for your clone to show up because of some caching mechanisms that have been put in place. It should show up pretty quickly though, and you'll be able to browse history via a web interface.
</p><p>Others can also pull changes via http:
</p>
<pre>hg clone http://hg.mozilla.org/users/your-hg_username.domain/my-repo1
</pre>
<h3 name="Pushing_Changes"> Pushing Changes </h3>
<p>To push changes, use ssh:
</p>
<pre class="eval">hg push ssh://hg.mozilla.org/users/your-hg_username.domain/my-repo1
</pre>
<p>You may also want to add that path to the repository's hgrc, so you don't have to type it every time. Put something like this in <code>.hg/hgrc</code>:
</p>
<pre class="eval">[paths]
default-push: ssh://hg.mozilla.org/users/your-hg_username.domain/my-repo1
</pre>
<h3 name="Bogus_error_message"> Bogus error message </h3>
<p>You will get the following bogus error message each time you ask <code>hg</code> to do anything that requires a command to be sent to the server.
</p>
<pre class="eval">remote: Could not chdir to home directory : No such file or directory
</pre>
<p>Just ignore it.
</p>
Revert to this revision