Mercurial > kallithea
annotate scripts/generate-ini.py @ 7144:bfb1ae42bcbb
vcs: fix get_changesets filtering on hg repo to AND the criteria instead of OR
Mercurial scmutil.revrange takes a list of filters ... and OR them.
But when for example a user uses the api and sets branch name and date, he would
expect to only get revisions from the provided branch.
So we need to use AND when filtering.
When using AND, the special handling of start_date and end_date is no longer necessary.
Also add a test to check for this use case.
author | domruf <dominikruf@gmail.com> |
---|---|
date | Sat, 20 Jan 2018 02:24:38 +0100 |
parents | 163d1c4f2b8b |
children | 150173a027ee |
rev | line source |
---|---|
5536
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python2 |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
2 """ |
6555
213085032127
gearbox: make a make-config sub-command available again
Mads Kiilerich <madski@unity3d.com>
parents:
6377
diff
changeset
|
3 Based on kallithea/lib/paster_commands/template.ini.mako, generate |
5536
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
4 development.ini |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
5 kallithea/tests/test.ini |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
6 """ |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
7 |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
8 import re |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
9 |
6884
e3cce237d77c
ini: extract .ini handling from scripts/generate-ini.py to kallithea/lib/inifile.py
Mads Kiilerich <mads@kiilerich.com>
parents:
6883
diff
changeset
|
10 from kallithea.lib import inifile |
e3cce237d77c
ini: extract .ini handling from scripts/generate-ini.py to kallithea/lib/inifile.py
Mads Kiilerich <mads@kiilerich.com>
parents:
6883
diff
changeset
|
11 |
5536
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
12 # files to be generated from the mako template |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
13 ini_files = [ |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
14 ('development.ini', |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
15 { |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
16 '[server:main]': { |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
17 'host': '0.0.0.0', |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
18 }, |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
19 '[app:main]': { |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
20 'initial_repo_scan': 'true', |
6573
fc6b1b0e1096
ini: set 'debug' only in one place
Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
parents:
6555
diff
changeset
|
21 'debug': 'true', |
5536
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
22 'app_instance_uuid': 'development-not-secret', |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
23 'beaker.session.secret': 'development-not-secret', |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
24 }, |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
25 '[handler_console]': { |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
26 'formatter': 'color_formatter', |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
27 }, |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
28 '[handler_console_sql]': { |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
29 'formatter': 'color_formatter_sql', |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
30 }, |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
31 }, |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
32 ), |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
33 ] |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
34 |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
35 |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
36 def main(): |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
37 # make sure all mako lines starting with '#' (the '##' comments) are marked up as <text> |
6894
94f6b23e52d0
ini: move high level functionality and defaults to inifiles library
Mads Kiilerich <mads@kiilerich.com>
parents:
6893
diff
changeset
|
38 makofile = inifile.template_file |
5536
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
39 print 'reading:', makofile |
6860
665dfa112f2c
py3: replace "file" with "open"
Lars Kruse <devel@sumpfralle.de>
parents:
6857
diff
changeset
|
40 mako_org = open(makofile).read() |
5536
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
41 mako_no_text_markup = re.sub(r'</?%text>', '', mako_org) |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
42 mako_marked_up = re.sub(r'\n(##.*)', r'\n<%text>\1</%text>', mako_no_text_markup, flags=re.MULTILINE) |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
43 if mako_marked_up != mako_org: |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
44 print 'writing:', makofile |
6860
665dfa112f2c
py3: replace "file" with "open"
Lars Kruse <devel@sumpfralle.de>
parents:
6857
diff
changeset
|
45 open(makofile, 'w').write(mako_marked_up) |
5536
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
46 |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
47 # create ini files |
6893
d06039dc4ca2
ini: drop insertion of header comments in generated ini files
Mads Kiilerich <mads@kiilerich.com>
parents:
6891
diff
changeset
|
48 for fn, settings in ini_files: |
5536
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
49 print 'updating:', fn |
6894
94f6b23e52d0
ini: move high level functionality and defaults to inifiles library
Mads Kiilerich <mads@kiilerich.com>
parents:
6893
diff
changeset
|
50 inifile.create(fn, None, settings) |
94f6b23e52d0
ini: move high level functionality and defaults to inifiles library
Mads Kiilerich <mads@kiilerich.com>
parents:
6893
diff
changeset
|
51 |
5536
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
52 |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
53 if __name__ == '__main__': |
06d5c043e989
ini: add scripts/generate-ini.py for generating all .ini files from template.ini.mako
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
54 main() |