Changeset - eb180eb16c18
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 13 years ago 2012-10-03 19:02:40
marcin@python-works.com
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.
3 files changed with 9 insertions and 5 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/pullrequests.py
Show inline comments
 
@@ -172,8 +172,9 @@ class PullrequestsController(BaseRepoCon
 

	
 
    @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'):
rhodecode/model/forms.py
Show inline comments
 
@@ -327,7 +327,7 @@ def UserExtraEmailForm():
 
    return _UserExtraEmailForm
 

	
 

	
 
def PullRequestForm():
 
def PullRequestForm(repo_id):
 
    class _PullRequestForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = True
 
@@ -337,7 +337,7 @@ def PullRequestForm():
 
        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)
rhodecode/model/validators.py
Show inline comments
 
@@ -666,7 +666,7 @@ def AttrLoginValidator():
 
    return _validator
 

	
 

	
 
def NotReviewedRevisions():
 
def NotReviewedRevisions(repo_id):
 
    class _validator(formencode.validators.FancyValidator):
 
        messages = {
 
            'rev_already_reviewed':
 
@@ -678,7 +678,10 @@ def NotReviewedRevisions():
 
            # 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:
0 comments (0 inline, 0 general)