#12480 closed defect (fixed)
Restore repository_sync_per_request for GitwebProjectsRepositoryProvider
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.2 |
Component: | plugin/git | Version: | |
Severity: | normal | Keywords: | gitweb |
Cc: | Branch: | ||
Release Notes: |
Gitweb repository configuration is moved from the |
||
API Changes: | |||
Internal Changes: |
Description
After changes in #11776, there is no way to specify repository_sync_per_request
for GitwebProjectsRepositoryProvider
.
Since GitwebProjectsRepositoryProvider
defines several attributes for specifying repositories, it should probably also have a sync_per_request
ListOption
. It might also make sense to move the options to a separate section, as was done with the [repositories]
section for the default repository provider.
[gitweb-repositories] projects_base = projects_list = projects_url = sync_per_request =
Attachments (0)
Change History (10)
comment:1 by , 9 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:2 by , 8 years ago
Release Notes: | modified (diff) |
---|
comment:3 by , 8 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Committed to trunk in [14873:14874].
comment:4 by , 8 years ago
The upgrade step fails when tracopt.versioncontrol.git.git_fs.GitwebProjectsRepositoryProvider
is not enabled. I'll add a test and fix shortly.
follow-up: 7 comment:5 by , 8 years ago
I added a method to allow components to be re-enabled in a test case, for use in [91874a31/rjollos.git]. Does it make sense, or is there a better way?: [bb235d88/rjollos.git]. I'm considering applying the change to 1.0-stable.
comment:6 by , 8 years ago
The default of [trac] repository_sync_per_request
option is (default)
. It needed to set explicitly an empty value to the option if don't want repository sync per request.
Therefore, we should use config.getlist(..., ..., '(default)')
rather than config.getlist(...) or ['(default)']
.
- repos_sync_per_request = \ - env.config.getlist('trac', 'repository_sync_per_request') \ - or ['(default)'] + repos_sync_per_request = env.config.getlist( + 'trac', 'repository_sync_per_request', '(default)')
Also, we should add unit tests for repository_sync_per_request
with repository
table.
+ def test_repository_sync_per_request_default_value_with_db(self): + """The default repository sync_per_request attribute is set to true + when repository_sync_per_request is not set in trac.ini. + """ + self.env.config.remove('trac', 'repository_sync_per_request') + # directly insert repository records instead of DbRepositoryProvider + # to avoid a TracError "The repository type 'svn' is not supported" + with self.env.db_transaction as db: + db.executemany("""INSERT INTO repository (id,name,value) + VALUES (%s,%s,%s)""", + [(1, 'name', ''), + (1, 'dir', '/var/svn'), + (1, 'type', 'svn'), + (2, 'name', 'git'), + (2, 'dir', '/var/git'), + (2, 'type', 'git')]) + + db32.do_upgrade(self.env, VERSION, None) + + repos = RepositoryManager(self.env).get_all_repositories() + self.assertIn('', repos) + self.assertTrue(repos['']['sync_per_request']) + self.assertEqual('1', self.env.db_query(""" + SELECT value FROM repository + WHERE id=1 AND name='sync_per_request'""")[0][0]) + self.assertIn('git', repos) + self.assertFalse(repos['git']['sync_per_request']) + self.assertEqual('0', self.env.db_query(""" + SELECT value FROM repository + WHERE id=2 AND name='sync_per_request'""")[0][0]) +
comment:7 by , 8 years ago
Replying to Ryan J Ollos:
I added a method to allow components to be re-enabled in a test case, for use in [91874a31/rjollos.git]. Does it make sense, or is there a better way?: [bb235d88/rjollos.git]. I'm considering applying the change to 1.0-stable.
This change was committed to 1.0-stable in r14976, merged to 1.2-stable in r14977, merged to trunk in r14978. I'll prepare additional changes with comment:6 suggestions.
comment:8 by , 8 years ago
comment:9 by , 8 years ago
Tests were passing locally for me after adding import from tracopt.versioncontrol.svn.svn_fs import SubversionConnector
, to allow calling DbRepositoryProvider.add_repository
, but fail on Travis CI. I guess that is due to no SVN bindings.
I will probably commit changes with the SQL insert from comment:6.
Proposed changes in log:rjollos.git:t12480_gitweb.