Struggling with Mercurial and pushing to a remote server (using Apache on server)

Robert Wood robert.wood at apostrophe.co.uk
Thu Jan 23 15:15:04 UTC 2014


Folks,

I [think I] am really close to getting my server able to serve Mercurial 
repositories. I want to have it so I can push to and pull from my 
desktop/laptop and Raspberry Pi. The Pi's running Debian, my 
desktop/laptop running Mageia [Linux]. When on the desktop I have a 
direct connection to the Pi over my LAN, usually when on the laptop via 
OpenVPN (the VPN works very well, I am sure this is not a factor here).

On the Pi I have set up my repos in /var/hg/repos

I have setup Apache on the Pi and I think, using ssh, I can clone a 
simple repository on to the Pi.

hg clone test ssh://pi//var/hg/repos

If I look on the Pi's file system in:

cd /var/hg/repos
ls -all

drwxrwxrwx 4 www-data www-data 4096 Jan 23 14:22 .
drwxr-xr-x 3 www-data www-data 4096 Jan 23 09:05 ..
drwxr-xr-x 3 robertw  robertw  4096 Jan 23 13:51 test

In test there is the .hg directory.

However, what I cannot work out for the life of me is how to push 
additional changes into that repository using http.

In this example project/repository only have one file (main.c); after 
the initial commit, I modified it, and committed it to my repository. 
Tortoise Hg can see that change too, so I am sure I have done that bit 
correctly (and have been using local repositories for a few months now).

I have tried a zillion combinations along the lines of:

hg push http://pi/repos/test

hg push http://pi//var/hg/repos

hg push http://pi/hg/repos

hg --repository /home/robertw/Software/version_control_tests/test 
outgoing --quiet --template {node}^M http://pi/var/hg/repos/test

(That last one was what Tortoise Hg tried for me)

However, none of these multitude of attempts get close to allowing me to 
add to my remote repository. (To be clear I've tried this from the 
command line and Tortoise Hg).

The type of errors I get are:

pushing to http://pi/hg/test
abort: HTTP Error 404: Not Found

Or:

  hg push http://pi
pushing to http://pi/
abort: 'http://pi/' does not appear to be an hg repository:
---%<--- (text/html)
<html><body><h1>It works!</h1>
<p>This is the default web page for this server.</p>
<p>The web server software is running but no content has been added, 
yet. Rob has changed summat</p>
</body></html>

---%<---


Or

hg push http://pi/hg/
pushing to http://pi/hg/
abort: 'http://pi/hg/' does not appear to be an hg repository:
---%<--- (text/html; charset=ascii)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<link rel="icon" href="/hg/static/hgicon.png" type="image/png" />
<meta name="robots" content="index, nofollow" />
<link rel="stylesheet" href="/hg/static/style-paper.css" type="text/css" />
<script type="text/javascript" src="/hg/static/mercurial.js"></script>

<title>Mercurial repositories index</title>
</head>
<body>

<div class="container">
<div class="menu">
<a href="http://mercurial.selenic.com/">
<img src="/hg/static/hglogo.png" width=75 height=90 border=0 
alt="mercurial" /></a>
</div>
<div class="main">
<h2>Mercurial Repositories</h2>

<table class="bigtable">
     <tr>
         <th><a href="?sort=name">Name</a></th>
         <th><a href="?sort=description">Description</a></th>
         <th><a href="?sort=contact">Contact</a></th>
         <th><a href="?sort=lastchange">Last modified</a></th>
         <th> </th>
     </tr>

<tr class="parity0">
<td><a href="/hg/"></a></td>
<td>unknown</td>
<td>unknown</td>
<td class="age">Thu, 23 Jan 2014 14:22:59 +0000</td>
<td class="indexlinks"></td>
</tr>

</table>
</div>
</div>
<script type="text/javascript">process_dates()</script>


</body>
</html>


---%<---
!

I have set up my Apache server and that appears correct as I can point 
Firefox to //pi/hg and it lists my one little test repository, with the 
Mercurial logo and that normal mercurial page, so I must be pretty close!

On the Pi:

cat hgweb.config
[paths]
/ = /var/hg/repos/*

-----------------------------------------------------------------------------------------

So, with all this information, can anyone tell me what I am doing wrong, 
or missing out or...? If you need any other information about the Pi's 
setup please ask.

Oh and /etc/hosts has Pi mapped to its IP address.

Many thanks!

Rob






More information about the Mercurial mailing list