Mercurial > kallithea
changeset 2893:eb180eb16c18 beta
Fixed #585, checks for status of revision where to strict, and made opening pull request with those revision impossible due to previosly set status.
Checks now are made also for the repository.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 03 Oct 2012 19:02:40 +0200 |
parents | 5fba3778431c |
children | 2654edfb1700 |
files | rhodecode/controllers/pullrequests.py rhodecode/model/forms.py rhodecode/model/validators.py |
diffstat | 3 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/controllers/pullrequests.py Wed Oct 03 18:41:57 2012 +0200 +++ b/rhodecode/controllers/pullrequests.py Wed Oct 03 19:02:40 2012 +0200 @@ -172,8 +172,9 @@ @NotAnonymous() def create(self, repo_name): + repo = RepoModel()._get_repo(repo_name) try: - _form = PullRequestForm()().to_python(request.POST) + _form = PullRequestForm(repo.repo_id)().to_python(request.POST) except formencode.Invalid, errors: log.error(traceback.format_exc()) if errors.error_dict.get('revisions'):
--- a/rhodecode/model/forms.py Wed Oct 03 18:41:57 2012 +0200 +++ b/rhodecode/model/forms.py Wed Oct 03 19:02:40 2012 +0200 @@ -327,7 +327,7 @@ return _UserExtraEmailForm -def PullRequestForm(): +def PullRequestForm(repo_id): class _PullRequestForm(formencode.Schema): allow_extra_fields = True filter_extra_fields = True @@ -337,7 +337,7 @@ org_ref = v.UnicodeString(strip=True, required=True) other_repo = v.UnicodeString(strip=True, required=True) other_ref = v.UnicodeString(strip=True, required=True) - revisions = All(v.NotReviewedRevisions()(), v.UniqueList(not_empty=True)) + revisions = All(v.NotReviewedRevisions(repo_id)(), v.UniqueList(not_empty=True)) review_members = v.UniqueList(not_empty=True) pullrequest_title = v.UnicodeString(strip=True, required=True, min=3)
--- a/rhodecode/model/validators.py Wed Oct 03 18:41:57 2012 +0200 +++ b/rhodecode/model/validators.py Wed Oct 03 19:02:40 2012 +0200 @@ -666,7 +666,7 @@ return _validator -def NotReviewedRevisions(): +def NotReviewedRevisions(repo_id): class _validator(formencode.validators.FancyValidator): messages = { 'rev_already_reviewed': @@ -678,7 +678,10 @@ # check revisions if they are not reviewed, or a part of another # pull request statuses = ChangesetStatus.query()\ - .filter(ChangesetStatus.revision.in_(value)).all() + .filter(ChangesetStatus.revision.in_(value))\ + .filter(ChangesetStatus.repo_id == repo_id)\ + .all() + errors = [] for cs in statuses: if cs.pull_request_id: