Difference between revisions of "Setting up a Repository"

From GeeklogWiki
Jump to: navigation, search
(Setting up a Mercurial Repository on cvs.geeklog.net)
 
(what to do with an existing hgrc file)
 
Line 32: Line 32:
 
== Setting the Permissions ==
 
== Setting the Permissions ==
  
The repository will now be owned by the current user and not be usable from any user accounts. Therefore, do this:
+
The repository will now be owned by the current user and not be usable from any user account. Therefore, do this:
  
 
<pre>chmod -R g+rws newname</pre>
 
<pre>chmod -R g+rws newname</pre>
Line 56: Line 56:
 
allow_archive = gz
 
allow_archive = gz
 
</pre>
 
</pre>
 +
 +
If the <tt>hgrc</tt> file already exists, remove whatever it contains (usually a <tt>[path]</tt> section) and start over fresh with the above content.
  
 
Obviously, you should fill in something sensible for the description and the name!
 
Obviously, you should fill in something sensible for the description and the name!

Latest revision as of 08:20, 16 May 2009

Note: This requires you to be logged in using the hosting account. It does not work with a user account.

Creating the Repository

First of all:

cd /cvsroot/hg

All Mercurial repositories are located in this directory.

The following instructions use newname for the name of the new repository.

Empty Repository

For a completely new and empty repository, simply do

hg init newname

Cloning an existing Repository

If you want to set up a repository that is a clone of an already existing repository (oldname), do

hg clone -U oldname newname

Note the -U (uppercase 'U') option. It creates a clone without checking out the files (as we don't need any checked-out files in a repository on this server).

Uploading an existing Repository

Use scp to upload an existing repository. You don't need to include the checked-out files, so you effectively only need the .hg directory. You could create a local clone using hg clone -U before the upload.


Setting the Permissions

The repository will now be owned by the current user and not be usable from any user account. Therefore, do this:

chmod -R g+rws newname

Ignore the "Operation not permitted" messages. Check that the permissions for the directory are now: drwxrwsr-x (note the 's').


Creating a hgrc file

Inside the newname/.hg/ directory, create a new file hgrc (no leading dot!) that contains this:

[trusted]
users = geeklog2
groups = users

[web]
baseurl = http://project.geeklog.net/cgi-bin/hgweb.cgi
style = gitweb
contact = contact-us(AT)lists.geeklog.net
description = (description goes here)
name = (repository name goes here)
allow_archive = gz

If the hgrc file already exists, remove whatever it contains (usually a [path] section) and start over fresh with the above content.

Obviously, you should fill in something sensible for the description and the name!

The allow_archive setting is optional - it allows downloading the repository as a .gz file.


Hooking it up with the Repository Viewer

  • Open the file ~/public_html/www/cgi-bin/hgweb.config
  • Add a line
    newname = /cvsroot/hg/newname
  • Call up the viewer and check that the new repository is listed.