Edgewall Software

Opened 10 years ago

Closed 9 years ago

Last modified 7 years ago

#11776 closed enhancement (fixed)

Move the repository_sync_per_request configuration option to the repositories section — at Version 9

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.3
Component: version control Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

The [trac] repository_sync_per_request option was removed and each repository now has a sync_per_request attribute. The default value of sync_per_request is False. An upgrade step handles the migration while preserving the behavior.

The sync_per_request attribute can be set on repositories defined in the database from the Repositories web admin page or using the trac-admin command. For repositories defined in the [repositories] section of trac.ini, the <name>.sync_per_request attribute can be edited.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

As described in comment:1:ticket:11703, move the [trac] repository_sync_per_request configuration option to the [repositories] section:

[repositories]
<name>.sync_per_request = true/false

and similarly add an attribute for repositories defined through DbRepostioryProvider. Also, allow the option to be configurable from the repositories web admin page. This might help with configuration issues like the one reported in #11767.

Change History (9)

comment:1 by Ryan J Ollos, 10 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 9 years ago

Status: newassigned

comment:3 by Ryan J Ollos, 9 years ago

Proposed changes in log:rjollos.git:t11776.1. TracRepositoryAdmin page modified to document these changes in 1.1/TracRepositoryAdmin@2.

comment:4 by anonymous, 9 years ago

Looking good. +1

comment:5 by Ryan J Ollos, 9 years ago

Changes for #11703 will need to be committed before these changes. Committing these changes first leads to test failures since there's no way to define explicit synchronization for the repository defined in [trac] repository_dir, and some tests in trac/versioncontrol/tests/functional.py depend on explicit synchronization.

comment:6 by Jun Omae, 9 years ago

I just confirmed rjollos.git@t11776.1.

  1. Even if sync_per_request is 0, sync is executed by each request.
  2. Synchronized '(default)' repository … is not logged even if sync is successful.
  3. If Sync on every request is Not recommended, I think the option should be disabled for new repository by default. Adding a large repository from repository admin panel, a user would have a long wait for next request.
  • trac/versioncontrol/api.py

    diff --git a/trac/versioncontrol/api.py b/trac/versioncontrol/api.py
    index 9b4e28e..0b33b6b 100644
    a b class DbRepositoryProvider(Component):  
    221221                "INSERT INTO repository (id, name, value) VALUES (%s, %s, %s)",
    222222                [(id, 'dir', dir),
    223223                 (id, 'type', type_ or ''),
    224                  (id, 'sync_per_request', '1')])
     224                 (id, 'sync_per_request', '0')])
    225225        rm.reload_repositories()
    226226
    227227    def add_alias(self, reponame, target):
    class RepositoryManager(Component):  
    336336        from trac.web.chrome import Chrome, add_warning
    337337        if handler is not Chrome(self.env):
    338338            for repo_info in self.get_all_repositories().values():
    339                 if not repo_info.get('sync_per_request'):
     339                if not as_bool(repo_info.get('sync_per_request')):
    340340                    continue
    341341                start = time.time()
    342342                repo_name = repo_info['name'] or '(default)'
    343343                try:
    344344                    repo = self.get_repository(repo_info['name'])
    345345                    repo.sync()
    346                     continue
    347346                except TracError as e:
    348347                    add_warning(req,
    349348                        _("Can't synchronize with repository \"%(name)s\" "
Last edited 9 years ago by Jun Omae (previous) (diff)

comment:7 by Jun Omae, 9 years ago

  1. We should use i18n:msg for span of new hint.
  • trac/versioncontrol/templates/admin_repositories.html

    diff --git a/trac/versioncontrol/templates/admin_repositories.html b/trac/versioncontrol/templates/admin_repositories.html
    index 8ad06a3..7df1daa 100644
    a b  
    8686                          disabled="${not info.editable or None}" />
    8787              Sync on every request
    8888            </label>
    89             <span class="hint">Not recommended. See <a href="${href.wiki('TracRepositoryAdmin') + '#ExplicitSync'}">explicit synchronization</a> for more info.</span>
     89            <span class="hint" i18n:msg="">Not recommended. See <a href="${href.wiki('TracRepositoryAdmin') + '#ExplicitSync'}">explicit synchronization</a> for more info.</span>
    9090          </div>
    9191          <div class="field">
    9292            <label><input type="checkbox" name="hidden" value="1" checked="${info.hidden or None}"

comment:8 by Ryan J Ollos, 9 years ago

Release Notes: modified (diff)

comment:9 by Ryan J Ollos, 9 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks for the review and patches. Committed to trunk in [13393:13394].

Note: See TracTickets for help on using tickets.