Jump to content

Mercurial: Difference between revisions

1,100 bytes added ,  6 May 2011
(changed filepath for hgweb.cgi)
 
(3 intermediate revisions by 2 users not shown)
Line 15: Line 15:
   receive@murphy (~/public_html) %  chmod 711 hg
   receive@murphy (~/public_html) %  chmod 711 hg
   receive@murphy (~/public_html) %  cd hg
   receive@murphy (~/public_html) %  cd hg
   receive@murphy (~/public_html/hg) %  cp /usr/share/doc/mercurial-common/examples/hgweb.cgi .
   receive@murphy (~/public_html/hg) %  cp /usr/share/doc/mercurial-common/examples/hgweb.cgi ./index.cgi
   receive@murphy (~/public_html/hg) %  chmod 755 hgweb.redbrick.cgi
   receive@murphy (~/public_html/hg) %  chmod 755 index.cgi


=== Step 2 - Set the repo location ===
=== Step 2 - Set the repo location ===


Open the hgweb.redbrick.cgi in nano (or any other text editor) and on the second to last line replace /YOUR/HOME/DIR/YOUR/REPO with the location of the repo you created. For me, this is /home/member/r/receive/hgrepo - the location will depend on where your home directory is. Optionally, replace "repository name" with something cooler.
Open the index.cgi in nano (or any other text editor) and on the second to last line replace /YOUR/HOME/DIR/YOUR/REPO with the location of the repo you created. For me, this is /home/member/r/receive/hgrepo - the location will depend on where your home directory is. Optionally, replace "repository name" with something cooler.


=== Step 3 - Set Up htaccess ===
=== Step 3 - Set Up htaccess ===
Line 30: Line 30:


<pre>
<pre>
RewriteEngine On
##################################
##################################
# Force all access to over https #
# Force all access to over https #
Line 35: Line 36:


RewriteCond %{SERVER_PORT} 80
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://www.redbrick.dcu.ie/~receive/hg
RewriteRule (.*) https://www.redbrick.dcu.ie/~receive/hg/




Line 50: Line 51:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-d
# Send requests to hgwebdir.cgi, appending the rest of url.
# Send requests to hgwebdir.cgi, appending the rest of url.
RewriteRule (.*) hgweb.redbrick.cgi/$1  [QSA,L]
RewriteRule (.*) index.cgi/$1  [QSA,L]


################################
################################
Line 74: Line 75:
   receive@murphy (~/public_html/hg) %  chmod 644 /home/member/r/receive/.hgpasswd
   receive@murphy (~/public_html/hg) %  chmod 644 /home/member/r/receive/.hgpasswd


== Using LDAP instead of the password file ==
In the .htaccess you created earlier replace the Options for password control with the following:
<pre>
################################
# Options for password control #
################################
AuthType Basic
AuthBasicProvider ldap
AuthName "Some sort of name"
AuthLDAPURL ldap://192.168.0.3:389/o=redbrick?uid?sub?objectClass=posixAccount
AuthzLDAPAuthoritative Off
Require valid-user
</pre>
And hey presto, no need for a password file and you can log in with your redbrick details, of course so can anyone else so if you want to restrict access replace
  Require valid-user
with
  Require user username1 username2 (Obviously replace username1 username2 with actual usernames etc)


== Cloning the Repo ==
== Cloning the Repo ==
Line 81: Line 107:
Go to whatever computer you want to start writing code on and clone a copy of the repo  
Go to whatever computer you want to start writing code on and clone a copy of the repo  


   andrew@laptop:~ $  hg clone https://www.redbrick.dcu.ie/~receive/hg
   andrew@laptop:~ $  hg clone https://www.redbrick.dcu.ie/~receive/hg/


Now I have a copy of the repo on my laptop I can work on. You should [http://mercurial.selenic.com/guide/ read the guide] to see all the commands that are available, but the basics you'll need are hg add and hg commit.  
Now I have a copy of the repo on my laptop I can work on. You should [http://mercurial.selenic.com/guide/ read the guide] to see all the commands that are available, but the basics you'll need are hg add and hg commit.  
Line 88: Line 114:
== Pushing ==
== Pushing ==


After making changes you can push them back to your repo on RedBrick.  
Before you are able to push changes to your repo you will need to specify which users have permission to do so. You will need to add the following lines to the configuration for your repo (~/hgrepo/.hg/hgrc).
 
  [web]
  allow_push = *
 
If you wish to only give certain users permission to push changes to your repo replace * with their usernames.
 
Now once you make changes you can push them back to your repo on RedBrick.  


   andrew@laptop:~/hg $ hg push
   andrew@laptop:~/hg $ hg push


You can now look at the changes on the web interface :)
You can now look at the changes on the web interface :)