Show More
@@ -4,7 +4,7 b' import os' | |||||
4 | import ConfigParser |
|
4 | import ConfigParser | |
5 | root = os.getcwd() |
|
5 | root = os.getcwd() | |
6 |
|
6 | |||
7 |
PYLONS_CONFIG_NAME = ' |
|
7 | PYLONS_CONFIG_NAME = 'production.ini' | |
8 |
|
8 | |||
9 | sys.path.append(root) |
|
9 | sys.path.append(root) | |
10 | config = ConfigParser.ConfigParser({'here':root}) |
|
10 | config = ConfigParser.ConfigParser({'here':root}) |
@@ -22,8 +22,14 b' class BaseController(WSGIController):' | |||||
22 | c.repo_switcher_list = _get_repos_switcher_cached(c.cached_repo_list) |
|
22 | c.repo_switcher_list = _get_repos_switcher_cached(c.cached_repo_list) | |
23 |
|
23 | |||
24 | if c.repo_name: |
|
24 | if c.repo_name: | |
25 |
c |
|
25 | cached_repo = c.cached_repo_list.get(c.repo_name) | |
26 | c.repository_branches = c.cached_repo_list[c.repo_name].branches |
|
26 | ||
|
27 | if cached_repo: | |||
|
28 | c.repository_tags = cached_repo.tags | |||
|
29 | c.repository_branches = cached_repo.branches | |||
|
30 | else: | |||
|
31 | c.repository_tags = {} | |||
|
32 | c.repository_branches = {} | |||
27 |
|
33 | |||
28 | self.sa = meta.Session |
|
34 | self.sa = meta.Session | |
29 |
|
35 |
@@ -274,7 +274,6 b' def send_email(recipients, subject, body' | |||||
274 | @task |
|
274 | @task | |
275 | def create_repo_fork(form_data, cur_user): |
|
275 | def create_repo_fork(form_data, cur_user): | |
276 | import os |
|
276 | import os | |
277 | from pylons_app.lib.utils import invalidate_cache |
|
|||
278 | from pylons_app.model.repo_model import RepoModel |
|
277 | from pylons_app.model.repo_model import RepoModel | |
279 | sa = get_session() |
|
278 | sa = get_session() | |
280 | rm = RepoModel(sa) |
|
279 | rm = RepoModel(sa) | |
@@ -286,7 +285,6 b' def create_repo_fork(form_data, cur_user' | |||||
286 | repo_fork_path = os.path.join(repos_path, form_data['fork_name']) |
|
285 | repo_fork_path = os.path.join(repos_path, form_data['fork_name']) | |
287 |
|
286 | |||
288 | MercurialRepository(str(repo_fork_path), True, clone_url=str(repo_path)) |
|
287 | MercurialRepository(str(repo_fork_path), True, clone_url=str(repo_path)) | |
289 | #invalidate_cache('cached_repo_list') |
|
|||
290 |
|
288 | |||
291 |
|
289 | |||
292 | def __get_codes_stats(repo_name): |
|
290 | def __get_codes_stats(repo_name): |
@@ -26,12 +26,13 b' from beaker.cache import cache_region' | |||||
26 | from mercurial import ui |
|
26 | from mercurial import ui | |
27 | from mercurial.hgweb.hgwebdir_mod import findrepos |
|
27 | from mercurial.hgweb.hgwebdir_mod import findrepos | |
28 | from pylons.i18n.translation import _ |
|
28 | from pylons.i18n.translation import _ | |
|
29 | from pylons_app.lib import helpers as h | |||
|
30 | from pylons_app.lib.utils import invalidate_cache | |||
29 | from pylons_app.lib.auth import HasRepoPermissionAny |
|
31 | from pylons_app.lib.auth import HasRepoPermissionAny | |
30 | from pylons_app.model import meta |
|
32 | from pylons_app.model import meta | |
31 | from pylons_app.model.db import Repository, User |
|
33 | from pylons_app.model.db import Repository, User | |
32 | from pylons_app.lib import helpers as h |
|
34 | from sqlalchemy.orm import joinedload | |
33 | from vcs.exceptions import RepositoryError, VCSError |
|
35 | from vcs.exceptions import RepositoryError, VCSError | |
34 | from sqlalchemy.orm import joinedload |
|
|||
35 | import logging |
|
36 | import logging | |
36 | import os |
|
37 | import os | |
37 | import sys |
|
38 | import sys | |
@@ -123,6 +124,8 b' class HgModel(object):' | |||||
123 |
|
124 | |||
124 | dbrepo = None |
|
125 | dbrepo = None | |
125 | if not initial: |
|
126 | if not initial: | |
|
127 | #for initial scann on application first run we don't | |||
|
128 | #have db repos yet. | |||
126 | dbrepo = sa.query(Repository)\ |
|
129 | dbrepo = sa.query(Repository)\ | |
127 | .options(joinedload(Repository.fork))\ |
|
130 | .options(joinedload(Repository.fork))\ | |
128 | .filter(Repository.repo_name == name)\ |
|
131 | .filter(Repository.repo_name == name)\ | |
@@ -169,4 +172,15 b' class HgModel(object):' | |||||
169 | yield tmp_d |
|
172 | yield tmp_d | |
170 |
|
173 | |||
171 | def get_repo(self, repo_name): |
|
174 | def get_repo(self, repo_name): | |
172 | return _get_repos_cached()[repo_name] |
|
175 | try: | |
|
176 | repo = _get_repos_cached()[repo_name] | |||
|
177 | return repo | |||
|
178 | except KeyError: | |||
|
179 | #i we're here and we got key errors let's try to invalidate the | |||
|
180 | #cahce and try again | |||
|
181 | invalidate_cache('cached_repo_list') | |||
|
182 | repo = _get_repos_cached()[repo_name] | |||
|
183 | return repo | |||
|
184 | ||||
|
185 | ||||
|
186 |
@@ -28,6 +28,8 b' import pylons.test' | |||||
28 | # Invoke websetup with the current config file |
|
28 | # Invoke websetup with the current config file | |
29 | #SetupCommand('setup-app').run([config_file]) |
|
29 | #SetupCommand('setup-app').run([config_file]) | |
30 |
|
30 | |||
|
31 | ##RUNNING DESIRED TESTS | |||
|
32 | #nosetests pylons_app.tests.functional.test_admin_settings:TestSettingsController.test_my_account | |||
31 |
|
33 | |||
32 | environ = {} |
|
34 | environ = {} | |
33 |
|
35 |
@@ -42,5 +42,14 b' class TestSettingsController(TestControl' | |||||
42 |
|
42 | |||
43 | #test if fork is visible in the list ? |
|
43 | #test if fork is visible in the list ? | |
44 | response = response.follow() |
|
44 | response = response.follow() | |
|
45 | ||||
|
46 | ||||
|
47 | #check if fork is marked as fork | |||
|
48 | response = self.app.get(url(controller='summary', action='index', | |||
|
49 | repo_name=fork_name)) | |||
|
50 | ||||
45 |
|
51 | |||
46 | print response |
|
52 | print response | |
|
53 | ||||
|
54 | assert 'Fork of %s' % repo_name in response.body, 'no message about that this repo is a fork' | |||
|
55 |
General Comments 0
You need to be logged in to leave comments.
Login now