[issue443] hg-mirror fails when hgwebdir does not reside in server root

Maximilian Gaß bts at bts.grml.org
Sat Mar 29 12:46:35 CET 2008


New submission from Maximilian Gaß <mxey at cloudconnected.org>:

A friend of mine runs hgwebdir as https://host/~user/hg.cgi, which does not work
with hg-mirror. hg-mirror takes for granted that hgwebdir is running from / on
the webserver. This patch fixes the problem.

# HG changeset patch
# User Maximilian Gaß <mxey at cloudconnected.org>
# Date 1206790872 -3600
# Node ID daaa2935ccc19df798594729bdfa87fcd4892442
# Parent  d0689d0310b2cc2ef83393c6b0fddb145b6fe79b
walkrepos: Start from server root, hgweb gives us absolute URLs

diff -r d0689d0310b2 -r daaa2935ccc1 hgutil/hg/util.py
--- a/hgutil/hg/util.py Sat Mar 29 09:37:46 2008 +0100
+++ b/hgutil/hg/util.py Sat Mar 29 12:41:12 2008 +0100
@@ -1,5 +1,6 @@ import os
 import os
 import urllib
+import urlparse
 
 from hgutil.util import QueueListBridge
 
@@ -38,6 +39,11 @@ def walkrepos_flat(path):
 
 def walkrepos_web(url):
     data = urllib.urlopen(url + '/?style=raw')
+
+    # hgweb gives absolute URLs, so start from server root
+    parts = urlparse.urlsplit(url)
+    url = urlparse.urlunsplit((parts[0], parts[1], '', '', ''))
+
     for i in data:
         i = i.strip("/\n")
         if len(i) > 0:

----------
messages: 1272
nosy: mxey
status: unread
title: hg-mirror fails when hgwebdir does not reside in server root

_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue443>
_____________________________________



More information about the Bugs-changes mailing list