Show More
@@ -70,7 +70,8 b' class ReposController(BaseController):' | |||||
70 | repo_model = RepoModel() |
|
70 | repo_model = RepoModel() | |
71 | c.users_array = repo_model.get_users_js() |
|
71 | c.users_array = repo_model.get_users_js() | |
72 | c.users_groups_array = repo_model.get_users_groups_js() |
|
72 | c.users_groups_array = repo_model.get_users_groups_js() | |
73 | c.landing_revs = ScmModel().get_repo_landing_revs() |
|
73 | choices, c.landing_revs = ScmModel().get_repo_landing_revs() | |
|
74 | c.landing_revs_choices = choices | |||
74 |
|
75 | |||
75 | def __load_data(self, repo_name=None): |
|
76 | def __load_data(self, repo_name=None): | |
76 | """ |
|
77 | """ | |
@@ -92,7 +93,9 b' class ReposController(BaseController):' | |||||
92 |
|
93 | |||
93 | return redirect(url('repos')) |
|
94 | return redirect(url('repos')) | |
94 |
|
95 | |||
95 | c.landing_revs = ScmModel().get_repo_landing_revs(c.repo_info) |
|
96 | choices, c.landing_revs = ScmModel().get_repo_landing_revs(c.repo_info) | |
|
97 | c.landing_revs_choices = choices | |||
|
98 | ||||
96 | c.default_user_id = User.get_by_username('default').user_id |
|
99 | c.default_user_id = User.get_by_username('default').user_id | |
97 | c.in_public_journal = UserFollowing.query()\ |
|
100 | c.in_public_journal = UserFollowing.query()\ | |
98 | .filter(UserFollowing.user_id == c.default_user_id)\ |
|
101 | .filter(UserFollowing.user_id == c.default_user_id)\ | |
@@ -140,7 +143,8 b' class ReposController(BaseController):' | |||||
140 | self.__load_defaults() |
|
143 | self.__load_defaults() | |
141 | form_result = {} |
|
144 | form_result = {} | |
142 | try: |
|
145 | try: | |
143 |
form_result = RepoForm(repo_groups=c.repo_groups_choices |
|
146 | form_result = RepoForm(repo_groups=c.repo_groups_choices, | |
|
147 | landing_revs=c.landing_revs_choices)()\ | |||
144 | .to_python(dict(request.POST)) |
|
148 | .to_python(dict(request.POST)) | |
145 | RepoModel().create(form_result, self.rhodecode_user) |
|
149 | RepoModel().create(form_result, self.rhodecode_user) | |
146 | if form_result['clone_uri']: |
|
150 | if form_result['clone_uri']: | |
@@ -208,7 +212,8 b' class ReposController(BaseController):' | |||||
208 | repo_model = RepoModel() |
|
212 | repo_model = RepoModel() | |
209 | changed_name = repo_name |
|
213 | changed_name = repo_name | |
210 | _form = RepoForm(edit=True, old_data={'repo_name': repo_name}, |
|
214 | _form = RepoForm(edit=True, old_data={'repo_name': repo_name}, | |
211 |
repo_groups=c.repo_groups_choices |
|
215 | repo_groups=c.repo_groups_choices, | |
|
216 | landing_revs=c.landing_revs_choices)() | |||
212 | try: |
|
217 | try: | |
213 | form_result = _form.to_python(dict(request.POST)) |
|
218 | form_result = _form.to_python(dict(request.POST)) | |
214 | repo = repo_model.update(repo_name, form_result) |
|
219 | repo = repo_model.update(repo_name, form_result) |
@@ -43,6 +43,7 b' from rhodecode.model.forms import RepoSe' | |||||
43 | from rhodecode.model.repo import RepoModel |
|
43 | from rhodecode.model.repo import RepoModel | |
44 | from rhodecode.model.db import RepoGroup |
|
44 | from rhodecode.model.db import RepoGroup | |
45 | from rhodecode.model.meta import Session |
|
45 | from rhodecode.model.meta import Session | |
|
46 | from rhodecode.model.scm import ScmModel | |||
46 |
|
47 | |||
47 | log = logging.getLogger(__name__) |
|
48 | log = logging.getLogger(__name__) | |
48 |
|
49 | |||
@@ -60,6 +61,8 b' class SettingsController(BaseRepoControl' | |||||
60 | repo_model = RepoModel() |
|
61 | repo_model = RepoModel() | |
61 | c.users_array = repo_model.get_users_js() |
|
62 | c.users_array = repo_model.get_users_js() | |
62 | c.users_groups_array = repo_model.get_users_groups_js() |
|
63 | c.users_groups_array = repo_model.get_users_groups_js() | |
|
64 | choices, c.landing_revs = ScmModel().get_repo_landing_revs() | |||
|
65 | c.landing_revs_choices = choices | |||
63 |
|
66 | |||
64 | @HasRepoPermissionAllDecorator('repository.admin') |
|
67 | @HasRepoPermissionAllDecorator('repository.admin') | |
65 | def index(self, repo_name): |
|
68 | def index(self, repo_name): | |
@@ -94,7 +97,8 b' class SettingsController(BaseRepoControl' | |||||
94 |
|
97 | |||
95 | _form = RepoSettingsForm(edit=True, |
|
98 | _form = RepoSettingsForm(edit=True, | |
96 | old_data={'repo_name': repo_name}, |
|
99 | old_data={'repo_name': repo_name}, | |
97 |
repo_groups=c.repo_groups_choices |
|
100 | repo_groups=c.repo_groups_choices, | |
|
101 | landing_revs=c.landing_revs_choices)() | |||
98 | try: |
|
102 | try: | |
99 | form_result = _form.to_python(dict(request.POST)) |
|
103 | form_result = _form.to_python(dict(request.POST)) | |
100 |
|
104 |
@@ -653,7 +653,7 b' def PasswordResetForm():' | |||||
653 |
|
653 | |||
654 |
|
654 | |||
655 | def RepoForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(), |
|
655 | def RepoForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(), | |
656 | repo_groups=[]): |
|
656 | repo_groups=[], landing_revs=[]): | |
657 | class _RepoForm(formencode.Schema): |
|
657 | class _RepoForm(formencode.Schema): | |
658 | allow_extra_fields = True |
|
658 | allow_extra_fields = True | |
659 | filter_extra_fields = False |
|
659 | filter_extra_fields = False | |
@@ -666,7 +666,7 b' def RepoForm(edit=False, old_data={}, su' | |||||
666 | private = StringBoolean(if_missing=False) |
|
666 | private = StringBoolean(if_missing=False) | |
667 | enable_statistics = StringBoolean(if_missing=False) |
|
667 | enable_statistics = StringBoolean(if_missing=False) | |
668 | enable_downloads = StringBoolean(if_missing=False) |
|
668 | enable_downloads = StringBoolean(if_missing=False) | |
669 | landing_rev = UnicodeString(strip=True, min=1, not_empty=True) |
|
669 | landing_rev = OneOf(landing_revs, hideList=True) | |
670 |
|
670 | |||
671 | if edit: |
|
671 | if edit: | |
672 | #this is repo owner |
|
672 | #this is repo owner | |
@@ -678,8 +678,8 b' def RepoForm(edit=False, old_data={}, su' | |||||
678 | return _RepoForm |
|
678 | return _RepoForm | |
679 |
|
679 | |||
680 |
|
680 | |||
681 | def RepoForkForm(edit=False, old_data={}, |
|
681 | def RepoForkForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(), | |
682 |
|
|
682 | repo_groups=[]): | |
683 | class _RepoForkForm(formencode.Schema): |
|
683 | class _RepoForkForm(formencode.Schema): | |
684 | allow_extra_fields = True |
|
684 | allow_extra_fields = True | |
685 | filter_extra_fields = False |
|
685 | filter_extra_fields = False | |
@@ -697,8 +697,8 b' def RepoForkForm(edit=False, old_data={}' | |||||
697 | return _RepoForkForm |
|
697 | return _RepoForkForm | |
698 |
|
698 | |||
699 |
|
699 | |||
700 | def RepoSettingsForm(edit=False, old_data={}, |
|
700 | def RepoSettingsForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(), | |
701 | supported_backends=BACKENDS.keys(), repo_groups=[]): |
|
701 | repo_groups=[], landing_revs=[]): | |
702 | class _RepoForm(formencode.Schema): |
|
702 | class _RepoForm(formencode.Schema): | |
703 | allow_extra_fields = True |
|
703 | allow_extra_fields = True | |
704 | filter_extra_fields = False |
|
704 | filter_extra_fields = False | |
@@ -707,7 +707,7 b' def RepoSettingsForm(edit=False, old_dat' | |||||
707 | description = UnicodeString(strip=True, min=1, not_empty=True) |
|
707 | description = UnicodeString(strip=True, min=1, not_empty=True) | |
708 | repo_group = OneOf(repo_groups, hideList=True) |
|
708 | repo_group = OneOf(repo_groups, hideList=True) | |
709 | private = StringBoolean(if_missing=False) |
|
709 | private = StringBoolean(if_missing=False) | |
710 | landing_rev = UnicodeString(strip=True, min=1, not_empty=True) |
|
710 | landing_rev = OneOf(landing_revs, hideList=True) | |
711 | chained_validators = [ValidRepoName(edit, old_data), ValidPerms(), |
|
711 | chained_validators = [ValidRepoName(edit, old_data), ValidPerms(), | |
712 | ValidSettings] |
|
712 | ValidSettings] | |
713 | return _RepoForm |
|
713 | return _RepoForm |
@@ -482,24 +482,31 b' class ScmModel(BaseModel):' | |||||
482 | :param repo: |
|
482 | :param repo: | |
483 | :type repo: |
|
483 | :type repo: | |
484 | """ |
|
484 | """ | |
|
485 | ||||
485 | hist_l = [] |
|
486 | hist_l = [] | |
|
487 | choices = [] | |||
486 | repo = self.__get_repo(repo) |
|
488 | repo = self.__get_repo(repo) | |
487 | hist_l.append(['tip', _('latest tip')]) |
|
489 | hist_l.append(['tip', _('latest tip')]) | |
|
490 | choices.append('tip') | |||
488 | if not repo: |
|
491 | if not repo: | |
489 | return hist_l |
|
492 | return choices, hist_l | |
490 |
|
493 | |||
491 | repo = repo.scm_instance |
|
494 | repo = repo.scm_instance | |
|
495 | ||||
492 | branches_group = ([(k, k) for k, v in |
|
496 | branches_group = ([(k, k) for k, v in | |
493 | repo.branches.iteritems()], _("Branches")) |
|
497 | repo.branches.iteritems()], _("Branches")) | |
494 | hist_l.append(branches_group) |
|
498 | hist_l.append(branches_group) | |
|
499 | choices.extend([x[0] for x in branches_group[0]]) | |||
495 |
|
500 | |||
496 | if repo.alias == 'hg': |
|
501 | if repo.alias == 'hg': | |
497 | bookmarks_group = ([(k, k) for k, v in |
|
502 | bookmarks_group = ([(k, k) for k, v in | |
498 | repo.bookmarks.iteritems()], _("Bookmarks")) |
|
503 | repo.bookmarks.iteritems()], _("Bookmarks")) | |
499 | hist_l.append(bookmarks_group) |
|
504 | hist_l.append(bookmarks_group) | |
|
505 | choices.extend([x[0] for x in bookmarks_group[0]]) | |||
500 |
|
506 | |||
501 | tags_group = ([(k, k) for k, v in |
|
507 | tags_group = ([(k, k) for k, v in | |
502 | repo.tags.iteritems()], _("Tags")) |
|
508 | repo.tags.iteritems()], _("Tags")) | |
503 | hist_l.append(tags_group) |
|
509 | hist_l.append(tags_group) | |
|
510 | choices.extend([x[0] for x in tags_group[0]]) | |||
504 |
|
511 | |||
505 | return hist_l |
|
512 | return choices, hist_l |
General Comments 0
You need to be logged in to leave comments.
Login now