comparison mercurial/hgweb/hgwebdir_mod.py @ 8536:6796d41be421

hgwebdir: fix [collections] evaluation under Windows Virtual and real path separators are not the same under Windows.
author Patrick Mezard <pmezard@gmail.com>
date Thu, 21 May 2009 20:32:45 +0200
parents 176d3d681702
children b48a1e081f23
comparison
equal deleted inserted replaced
8426:2ff17c4de1da 8536:6796d41be421
70 if prefix: 70 if prefix:
71 name = prefix + '/' + name 71 name = prefix + '/' + name
72 self.repos.append((name, path)) 72 self.repos.append((name, path))
73 if cp.has_section('collections'): 73 if cp.has_section('collections'):
74 for prefix, root in cp.items('collections'): 74 for prefix, root in cp.items('collections'):
75 prefix = util.pconvert(prefix)
75 for path in util.walkrepos(root, followsym=True): 76 for path in util.walkrepos(root, followsym=True):
76 repo = os.path.normpath(path) 77 repo = os.path.normpath(path)
77 name = repo 78 name = util.pconvert(repo)
78 if name.startswith(prefix): 79 if name.startswith(prefix):
79 name = name[len(prefix):] 80 name = name[len(prefix):]
80 self.repos.append((name.lstrip(os.sep), repo)) 81 self.repos.append((name.lstrip('/'), repo))
81 self.repos.sort() 82 self.repos.sort()
82 83
83 def run(self): 84 def run(self):
84 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): 85 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
85 raise RuntimeError("This function is only intended to be called while running as a CGI script.") 86 raise RuntimeError("This function is only intended to be called while running as a CGI script.")