changeset range: move gravatar in front of revision link
In the past this was done by setting float:left on the gravatar. This got lost during the partial bootstrap changes. But the html layout should try to reflect the same order as the visual representation. So this now does it in the html code.
templates: more consistently put icons inside 'Delete' and 'Edit' buttons
- on repo, repo group, user and user group list page.
For now, we keep the text and keep the button visible.
The Edit button was typically a submit button, not inside a form but inside an <a>. It did thus not really trigger a submit but just followed the link.
api: change precision of ChangesetStatus.modified_at to seconds
Per default MySQL only uses seconds. So in order to be consistent on all databases, this is the easiest solution. I don't think the microseconds are necessary. And AFAICS mercurial only uses seconds for the changeset modification time as well. So why should we use microseconds for ChangesetStatus.
Without this, for example test_api_get_changeset_with_reviews fails, because of datetime mismatch if MySQL is used.
autocomplete: use select2 when selecting users to add as reviewers to PRs
This is a minimal change to PullRequestAutoComplete, inspired by Dominik Ruf.
The UX is slightly different than before, with select2 putting up an extra input field, already before typing anything.
We use minimumInputLength 1 to get the same behaviour as before and avoid displaying all users in a list.
The select2 widget is reused for adding more users, so when a user is selected, we process it, close the widget, and abort the selection, waiting for the user to enter another user name.
autocomplete: use select2 when selecting owner of repos and PRs
This is a minimal change to SimpleUserAutoComplete, inspired by Dominik Ruf.
The UX is slightly different than before, with select2 putting up an extra input field, already before typing anything.
We use minimumInputLength 1 to get the same behaviour as before and avoid displaying all users in a list. This field will always have an old value and the placeholder is thus never used, but we show it instead of the default "Please enter 1 or more character" message.
The initSelection iteration is not pretty, but no more complex than what happens when filtering the user list, and it has the advantage of giving a nice name/gravatar display of the current user.
celery: replace loader.PylonsSettingsProxy with a simple configuration object
The proxy was quite complex and did all the conversion at runtime, making it hard to figure out exactly what it was doing.
Instead, just create a simple configuration object as described on http://docs.celeryproject.org/en/3.1/userguide/application.html and convert all relevant config settings up front. We don't convert all config settings, but only the ones Celery seems to be interested in. The value conversion heuristics are the same as before and still seem quite fragile.
celery: simplify internal configuration and app creation
We used celery.app.app_or_default() which creates a "global fallback app instance" which relies on the CELERY_LOADER environment variable to load the configuration. That worked but was messy.
Instead, do something more like described in http://docs.celeryproject.org/en/3.1/userguide/application.html where the app is a celery.Celery() instance and configuration is loaded explicitly by its config_from_object method. Using config_from_object we don't need explicit invocation of import_default_modules and can take pass PylonsSettingsProxy directly, leaving PylonsLoader unused and removed.
celeryd: let the gearbox command use db session as most other gearbox commands do
304aae43194c changed the common gearbox wrapper so make_app_without_logging only was run for commands tagged as requires_db_session. That broke celeryd - even a plain 'gearbox celeryd -c my.ini' would fail on the safety check in celerypylons asserting on tg.config having 'celery.imports' configuration.
The gearbox celeryd command did not really require a db session - it just required app configuration so it could create db sessions on the fly.
To to get the missing make_app_without_logging invocation back, set requires_db_session (the default for our gearbox commands).
requires_db_session not only calls make_app_without_logging (which undo the effect from 304aae43194c), it also calls setup_cache_regions, engine_from_config, and init_model. These were also invoked explicitly in celeryd code - these double invocations are dropped too.
Also, make_app_without_logging will call into tg and thus invoke the setup_configuration hook which will set kallithea.CELERY_ON and call load_rcextensions. The celeryd code for doing that is thus dropped.
rcext: this command actually *does* require a config file ... but doesn't require db configuration
'gearbox make-rcext' would fail when trying to do config['here'] without initializing the configuration.
The command would work if we gave it a whole db session, but it is more correct to only require the configuration if that is all it need. The command will however still fail, as the configuration isn't passed on to tg.config .
manifest: update file name list - for example, fix the path to the template.ini.mako config template
The template.ini.mako was renamed in 6c8af2d22deb when the gearbox make-config command was introduced. 'gearbox make-config' in an installed environment would fail without this file.
tests: don't silence errors while creating test index
"Errors should never pass silently." For example, I had the problem, that a previous test did not clean up the lock file for the index_dir, which then caused the future tests to fail. Because the error has been silenced, it took a while until I found the reason.
docs: recommend --upgrade for all pip installations in a virtualenv
As suggested by Mads Kiilerich.
Don't recommend this practice when no virtualenv is used, i.e. root installation or --user installation: in this case upgrading existing packages may be too disruptive. The user can still add it manually if he so chooses.
tests: vcs: remove influence of user's hg settings
Certain settings in the user's hgrc file can cause test failures. For example, enabling a non-existent extension prints stderr messages like
*** failed to import extension journal: No module named journal
Tests that check stderr output for emptiness, like test_clone_hg_repo_by_admin, then fail.
Instead, avoid all influence of the user's settings, by setting HGRCPATH and HGPLAIN to empty.
In versions of Mercurial before 4.2, setting an empty HGRCPATH was generally enough to get expected behavior, but since 4.2 the behavior of some commands has changed, and a pager is now default. Setting HGPLAIN is a simple way of neutralizing even that.
tests: fix failures due to environment LANG settings (Issue #286)
When the environment in which the tests are run dictates a non-English language (e.g. via LANG=de_DE.UTF-8), certain tests started to fail because formencode validation messages where translated in that language.
A test failing this way is for example test_create_in_group_without_needed_permissions in kallithea/tests/functional/test_admin_repos.py .
This is a regression of commit 3b29103657df (i18n: remove explicit formencode language setting), but in fact reverting it is not the right solution as there is no problem except during test execution.
Instead, force the formencode language to 'empty' (meaning English) for test execution only.
docs/contributing: move installation of dev_requirements to default instructions
When intending to contribute to Kallithea, you are expected to run all tests, so installation of the dev_requirements are actually mandatory. Hence, update the instructions.
docs/contributing: make contribution information more accessible
Try to make the contribution information more accessible to new users, by giving a bit more detail about the different steps in making contributions.
Some rework of the original patch done by Thomas De Schampheleire: - don't give the impression that Bitbucket is mandatory - don't recommend creating feature branches for regular development - reword/cross-reference section on contribution flow
Some rework of the original patch done by Thomas De Schampheleire: - generalize to cover both Mercurial and Git - simplify instructions for importing via filesystem: don't impose a certain flow as it depends on different factors: are the repos already present on the machine, are they organized in a flat hierarchy or already in a more complex one, ... - invalidating cache while rescanning should not be needed when adding new repositories
git: improve performance working with git changesets
GitRepository._repo instantiates a new dulwich.repo.Repo on every usage, rather than once at initialization time of GitRepository. As this involves a lot of filesystem access, this is a costly operation.
Instead, let GitRepository.__init__ instantiate a dulwich.repo.Repo once, and let GitRepository._repo just return it.
This improves performance significantly. On test_graphmod_git, performance improves from 6.29 seconds median to 3.06 seconds median.
[Thomas De Schampheleire: extend improvement to _all_ usage of GitRepository._repo instead of only some. To limit the delta, retain the _repo property but simply return self.repo.]
pytest-benchmark is a benchmarking suite for individual functions. It presents itself as a pytest fixture, i.e. you accept it as a test function argument, and then can use it to benchmark a function.
Output is presented in the following form:
----------------------------------------- benchmark: 1 tests ---------------------------------------- Name (time in s) Min Max Mean StdDev Median IQR Outliers(*) Rounds Iterations ----------------------------------------------------------------------------------------------------- test_graphmod_git 3.1122 3.1682 3.1295 0.0236 3.1196 0.0313 1;0 5 1 -----------------------------------------------------------------------------------------------------
style: drop form-horizontal - our style is much closer to plain Bootstrap forms
form-horizontal is made for grid markup. It give form-groups a negative margin to break out of the grid ... but the way we use it for settings, we have to do weird things to undo that. The default styling for forms is much closer to what we want. It looks ok without our custom styling and is easier to style to our style.
If we want grid markup with form-horizontal, it would be correct to re-introduce both at once.
graph: align the dots with the middle of the first *visible* child element
The changelog graph will have invisible first elements when a range is selected. That caused an odd graph. Fixed by adding the :visible selector that was lost in 5258b66bf5d7.
docs: add documentation about internationalization from a user perspective
While there is already documentation about creating and updating translations (developer perspective), there was nothing for the user/admin of Kallithea. Since the handling in TurboGears2 is different, this is a good time to add it.
i18n: use TG2 compatible settings names i18n.lang and i18n.enabled
Following changes are made: - Remove list of available translations: severely outdated and hard to maintain. - Replace lang with i18n.lang, reasons: - Follow TurboGears2 conventions - Align with 'i18n.enabled' which cannot be shortened - Scoped settings provide grouping and are more clear The old 'lang' is still recognized though, so no upgrade issue. - Introduce/document i18n.enabled
Comments are intentionally kept concise in favor of the documentation.
Under TurboGears2, automatic user language detection based on browser settings is enabled by default. If a user has 'English' as preferred language in the browser, then the old English .mo file with a few dummy entries would be read and used first, before trying the language configured in the Kallithea .ini file (e.g. French). This renders a mix of languages in the UI ... which is unexpected.
The hiding of configured translation is fixed by removing the old english translationfile. It was preserved via commit 7d6c4bd58abd when removing all other .mo files. The next release will require major config changes anyway, and we don't try to be backwards compatible.
When the browser size has been changed, the dots may no longer be correctly aligned with the table rows. Currently, the graph will just overflow without changing size, but that can soon change.