diff --git a/trac/env.py b/trac/env.py
|
a
|
b
|
|
| 253 | 253 | return False |
| 254 | 254 | return enabled |
| 255 | 255 | |
| 256 | | # versioncontrol components are automatically enabled if the |
| 257 | | # repository_dir key is present in the [trac] section |
| 258 | | # FIXME: this probably shouldn't be hardcoded like this |
| 259 | | if component_name.startswith('trac.versioncontrol.'): |
| 260 | | return 'repository_dir' in self.config['trac'] |
| 261 | | |
| 262 | 256 | # By default, all components in the trac package are enabled |
| 263 | 257 | return component_name.startswith('trac.') |
| 264 | 258 | |
diff --git a/trac/versioncontrol/admin.py b/trac/versioncontrol/admin.py
|
a
|
b
|
|
| 14 | 14 | import sys |
| 15 | 15 | |
| 16 | 16 | from trac.admin import IAdminCommandProvider, IAdminPanelProvider, get_dir_list |
| | 17 | from trac.config import _TRUE_VALUES |
| 17 | 18 | from trac.core import * |
| 18 | 19 | from trac.util.text import breakable_path, normalize_whitespace, print_table, \ |
| 19 | 20 | printerr, printout |
| … |
… |
|
| 190 | 191 | changes = {} |
| 191 | 192 | for field in db_provider.repository_attrs: |
| 192 | 193 | value = normalize_whitespace(req.args.get(field)) |
| 193 | | if value is not None and value != info.get(field): |
| | 194 | if (value is not None or field == 'hidden') \ |
| | 195 | and value != info.get(field): |
| 194 | 196 | changes[field] = value |
| 195 | 197 | if changes: |
| 196 | 198 | db_provider.modify_repository(reponame, changes) |
| … |
… |
|
| 300 | 302 | info['prettydir'] = breakable_path(info['dir']) or '' |
| 301 | 303 | if info.get('alias') == '': |
| 302 | 304 | info['alias'] = '(default)' |
| | 305 | info['hidden'] = info.get('hidden') in _TRUE_VALUES |
| 303 | 306 | info['editable'] = editable |
| 304 | 307 | if not info.get('alias'): |
| 305 | 308 | try: |
diff --git a/trac/versioncontrol/api.py b/trac/versioncontrol/api.py
|
a
|
b
|
|
| 96 | 96 | |
| 97 | 97 | implements(IRepositoryProvider, IAdminCommandProvider) |
| 98 | 98 | |
| 99 | | repository_attrs = ('alias', 'dir', 'type', 'url') |
| | 99 | repository_attrs = ('alias', 'dir', 'hidden', 'type', 'url') |
| 100 | 100 | |
| 101 | 101 | # IRepositoryProvider methods |
| 102 | 102 | |
| … |
… |
|
| 262 | 262 | |
| 263 | 263 | repository_dir = Option('trac', 'repository_dir', '', |
| 264 | 264 | """Path to the default repository. This can also be a relative path |
| 265 | | (''since 0.11''). If this entry is specified (even when left empty), |
| 266 | | this will auto-enable the trac.versioncontrol.* components. |
| 267 | | This means that if you want to use Trac without the source browser, |
| 268 | | simply remove that entry from the [trac] section.""") |
| | 265 | (''since 0.11''). |
| | 266 | |
| | 267 | This option is deprecated, and repositories should be defined in the |
| | 268 | `[repositories]` section, or using the "Repositories" admin panel. |
| | 269 | (''since 0.12'')""") |
| 269 | 270 | |
| 270 | 271 | repository_sync_per_request = ListOption('trac', |
| 271 | 272 | 'repository_sync_per_request', '(default)', |
| … |
… |
|
| 369 | 370 | for option in repositories: |
| 370 | 371 | if option.endswith('.dir'): |
| 371 | 372 | reponames[option[:-4]] = {} |
| 372 | | # second pass to gather the <name>.<detail> entries or <alias> ones |
| | 373 | # second pass to gather aliases |
| | 374 | for option in repositories: |
| | 375 | if '.' not in option: |
| | 376 | alias = repositories.get(option) |
| | 377 | if reponames.get(alias) == {}: |
| | 378 | reponames[option] = {'alias': alias} |
| | 379 | # third pass to gather the <name>.<detail> entries |
| 373 | 380 | for option in repositories: |
| 374 | 381 | if '.' in option: |
| 375 | | dotindex = option.rindex('.') |
| 376 | | name, detail = option[:dotindex], option[dotindex+1:] |
| | 382 | name, detail = option.rsplit('.', 1) |
| 377 | 383 | if name in reponames: |
| 378 | 384 | reponames[name][detail] = repositories.get(option) |
| 379 | | elif detail == 'alias': |
| 380 | | alias = repositories.get(option) |
| 381 | | if alias in reponames: |
| 382 | | reponames[option] = {'alias': alias} |
| 383 | 385 | # eventually add pre-0.12 default repository |
| 384 | 386 | if '' not in reponames and self.repository_dir: |
| 385 | 387 | reponames[''] = {'dir': self.repository_dir} |
diff --git a/trac/versioncontrol/templates/admin_repositories.html b/trac/versioncontrol/templates/admin_repositories.html
|
a
|
b
|
|
| 62 | 62 | </div> |
| 63 | 63 | </py:otherwise> |
| 64 | 64 | </py:choose> |
| | 65 | <div class="field"> |
| | 66 | <label><input type="checkbox" name="hidden" value="1" checked="${info.hidden or None}"/> |
| | 67 | Hide from repository index |
| | 68 | </label> |
| | 69 | </div> |
| 65 | 70 | <div class="buttons"> |
| 66 | 71 | <input type="submit" name="cancel" value="${_('Cancel')}"/> |
| 67 | 72 | <input py:if="info.editable" type="submit" name="save" value="${_('Save')}"/> |
diff --git a/trac/versioncontrol/templates/browser.html b/trac/versioncontrol/templates/browser.html
|
a
|
b
|
|
| 47 | 47 | <body> |
| 48 | 48 | <div id="content" class="browser"> |
| 49 | 49 | |
| 50 | | <py:if test="repo"> |
| 51 | | <h1>Repository Index</h1> |
| 52 | | <py:with vars="repoindex = 'repoindex'"> |
| 53 | | <xi:include href="repository_index.html" /> |
| 54 | | </py:with> |
| 55 | | </py:if> |
| 56 | | |
| 57 | 50 | <py:if test="dir or file"> |
| 58 | 51 | <py:choose> |
| 59 | | <py:when test="repo"> |
| 60 | | <hr /> |
| 61 | | <h1>Default Repository</h1> |
| 62 | | <p class="hint">The entries in that repository are reachable directly, |
| 63 | | without a repository prefix. <br /> |
| 64 | | However, a repository name will always take precedence over a similarly |
| 65 | | named entry in the default repository. <br /> |
| 66 | | If this is a problem, add a separate explicit entry for that repository.</p> |
| 67 | | </py:when> |
| | 52 | <h1 py:when="repo">Default Repository</h1> |
| 68 | 53 | <h1 py:otherwise=""><xi:include href="path_links.html" /></h1> |
| 69 | 54 | </py:choose> |
| 70 | 55 | |
| … |
… |
|
| 153 | 138 | </tr> |
| 154 | 139 | </table> |
| 155 | 140 | |
| | 141 | <py:if test="repo and repo.repositories"> |
| | 142 | <hr py:if="dir"/> |
| | 143 | <h1>Repository Index</h1> |
| | 144 | <py:with vars="repoindex = 'repoindex'"> |
| | 145 | <xi:include href="repository_index.html" /> |
| | 146 | </py:with> |
| | 147 | </py:if> |
| | 148 | |
| 156 | 149 | <div py:if="file and file.preview" id="preview" class="searchable"> |
| 157 | 150 | ${preview_file(file.preview)} |
| 158 | 151 | </div> |
diff --git a/trac/versioncontrol/templates/repository_index.html b/trac/versioncontrol/templates/repository_index.html
|
a
|
b
|
|
| 9 | 9 | <tr class="${idx % 2 and 'even' or 'odd'}"> |
| 10 | 10 | <td class="name"> |
| 11 | 11 | <em py:strip="not err"> |
| 12 | | <a class="dir" title="View Root Directory" |
| 13 | | href="${href.browser(reponame, order=(order != 'name' and order or None), desc=desc)}" py:choose="reponame"><b py:when="''">(default)</b><py:otherwise>$reponame</py:otherwise></a> |
| | 12 | <b py:strip="repoinfo.alias != ''"> |
| | 13 | <a class="dir" title="View Root Directory" |
| | 14 | href="${href.browser(reponame, order=(order != 'name' and order or None), desc=desc)}">$reponame</a> |
| | 15 | </b> |
| 14 | 16 | </em> |
| 15 | 17 | </td> |
| 16 | 18 | <td class="size" /> |
diff --git a/trac/versioncontrol/web_ui/browser.py b/trac/versioncontrol/web_ui/browser.py
|
a
|
b
|
|
| 23 | 23 | |
| 24 | 24 | from genshi.builder import tag |
| 25 | 25 | |
| 26 | | from trac.config import ListOption, BoolOption, Option |
| | 26 | from trac.config import ListOption, BoolOption, Option, _TRUE_VALUES |
| 27 | 27 | from trac.core import * |
| 28 | 28 | from trac.mimeview.api import Mimeview, is_binary, get_mimetype, \ |
| 29 | 29 | IHTMLPreviewAnnotator, Context |
| … |
… |
|
| 338 | 338 | # Repository index |
| 339 | 339 | all_repositories = None |
| 340 | 340 | if not reponame and path == '/': |
| 341 | | all_repositories = rm.get_all_repositories().items() |
| 342 | | if all_repositories: |
| 343 | | repos = rm.get_repository('', req.authname) |
| | 341 | all_repositories = rm.get_all_repositories() |
| | 342 | if all_repositories and repos \ |
| | 343 | and all_repositories[''].get('hidden') in _TRUE_VALUES: |
| | 344 | repos = None |
| 344 | 345 | |
| 345 | 346 | if not repos and reponame: |
| 346 | 347 | raise ResourceNotFound(_("No repository '%(repo)s' found", |
| … |
… |
|
| 450 | 451 | |
| 451 | 452 | rm = RepositoryManager(self.env) |
| 452 | 453 | repositories = [] |
| 453 | | for reponame, repoinfo in all_repositories: |
| | 454 | for reponame, repoinfo in all_repositories.items(): |
| | 455 | if not reponame or repoinfo.get('hidden') in _TRUE_VALUES: |
| | 456 | continue |
| 454 | 457 | try: |
| 455 | 458 | repos = rm.get_repository(reponame, context.perm.username) |
| 456 | 459 | if repos: |