Mercurial > self-hosted
comparison Mercurial/hgweb.wsgi.exmaple @ 0:edd512324c03
Add:Mercurial Files
| author | Pluto <meokcin@gmail.com> |
|---|---|
| date | Tue, 03 Sep 2024 16:30:52 +0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:edd512324c03 |
|---|---|
| 1 import sys | |
| 2 import os | |
| 3 from mercurial import demandimport | |
| 4 demandimport.enable() | |
| 5 # 设置编码为UTF-8 | |
| 6 if not isinstance(os.environ.get('PYTHONIOENCODING'), str): | |
| 7 os.environ['PYTHONIOENCODING'] = 'utf-8' | |
| 8 from mercurial.hgweb.hgwebdir_mod import hgwebdir | |
| 9 # 确保配置文件路径正确 | |
| 10 config_path = '/var/hg/hgweb.config' | |
| 11 if not os.path.isabs(config_path): | |
| 12 config_path = os.path.join(os.getcwd(), config_path) | |
| 13 # 确保路径是字节串,以防 Mercurial 需要字节串路径 | |
| 14 config_path_bytes = config_path.encode('utf-8') | |
| 15 application = hgwebdir(config_path_bytes) |
