| LEFT | RIGHT |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # An example CGI script to export multiple hgweb repos, edit as necessary | 3 # An example CGI script to export multiple hgweb repos, edit as necessary |
| 4 | 4 |
| 5 import re | 5 import re |
| 6 | 6 |
| 7 # adjust python path if not a system-wide install: | 7 # adjust python path if not a system-wide install: |
| 8 #import sys | 8 #import sys |
| 9 #sys.path.insert(0, "/path/to/python/lib") | 9 #sys.path.insert(0, "/path/to/python/lib") |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 # | 46 # |
| 47 # [paths] | 47 # [paths] |
| 48 # virtual/path1 = /real/path1 | 48 # virtual/path1 = /real/path1 |
| 49 # virtual/path2 = /real/path2 | 49 # virtual/path2 = /real/path2 |
| 50 # virtual/root = /real/root/* | 50 # virtual/root = /real/root/* |
| 51 # / = /real/root2/* | 51 # / = /real/root2/* |
| 52 # | 52 # |
| 53 # [collections] | 53 # [collections] |
| 54 # /prefix/to/strip/off = /root/of/tree/full/of/repos | 54 # /prefix/to/strip/off = /root/of/tree/full/of/repos |
| 55 # | 55 # |
| 56 # paths example: | 56 # paths example: |
| 57 # | 57 # |
| 58 # * First two lines mount one repository into one virtual path, like | 58 # * First two lines mount one repository into one virtual path, like |
| 59 # '/real/path1' into 'virtual/path1'. | 59 # '/real/path1' into 'virtual/path1'. |
| 60 # | 60 # |
| 61 # * The third entry tells every mercurial repository found in | 61 # * The third entry tells every mercurial repository found in |
| 62 # '/real/root', recursively, should be mounted in 'virtual/root'. This | 62 # '/real/root', recursively, should be mounted in 'virtual/root'. This |
| 63 # format is preferred over the [collections] one, using absolute paths | 63 # format is preferred over the [collections] one, using absolute paths |
| 64 # as configuration keys is not supported on every platform (including | 64 # as configuration keys is not supported on every platform (including |
| 65 # Windows). | 65 # Windows). |
| 66 # | 66 # |
| (...skipping 19 matching lines...) Expand all Loading... |
| 86 else: | 86 else: |
| 87 return result | 87 return result |
| 88 | 88 |
| 89 def do_filter(self, iter, req): | 89 def do_filter(self, iter, req): |
| 90 for chunk in iter: | 90 for chunk in iter: |
| 91 yield re.sub(r'\bemail=.*?([\r\n]|$)', r'email=xxxx\1',
chunk) | 91 yield re.sub(r'\bemail=.*?([\r\n]|$)', r'email=xxxx\1',
chunk) |
| 92 if hasattr(iter, 'close'): | 92 if hasattr(iter, 'close'): |
| 93 iter.close() | 93 iter.close() |
| 94 | 94 |
| 95 WSGIServer(hgwebdir_with_filter('/etc/hgweb.ini'), debug=False).run() | 95 WSGIServer(hgwebdir_with_filter('/etc/hgweb.ini'), debug=False).run() |
| LEFT | RIGHT |