Changeset - f54dca244402
[Not reviewed]
default
0 2 0
Mads Kiilerich - 12 years ago 2013-12-10 19:30:37
madski@unity3d.com
changeset: refactor set_status so a comment always must be specified
2 files changed with 12 insertions and 12 deletions:
0 comments (0 inline, 0 general)
kallithea/model/changeset_status.py
Show inline comments
 
@@ -112,7 +112,7 @@ class ChangesetStatusModel(BaseModel):
 
            return str(status.status) if status else ChangesetStatus.DEFAULT
 
        return status
 

	
 
    def set_status(self, repo, status, user, comment=None, revision=None,
 
    def set_status(self, repo, status, user, comment, revision=None,
 
                   pull_request=None, dont_allow_on_closed_pull_request=False):
 
        """
 
        Creates new status for changeset or updates the old ones bumping their
 
@@ -130,15 +130,6 @@ class ChangesetStatusModel(BaseModel):
 
        repo = self._get_repo(repo)
 

	
 
        q = ChangesetStatus.query()
 
        if not comment:
 
            from kallithea.model.comment import ChangesetCommentsModel
 
            comment = ChangesetCommentsModel().create(
 
                text=u'Auto status change to %s' % (ChangesetStatus.get_status_lbl(status)),
 
                repo=repo,
 
                user=user,
 
                pull_request=pull_request,
 
                send_email=False
 
            )
 
        if revision:
 
            q = q.filter(ChangesetStatus.repo == repo)
 
            q = q.filter(ChangesetStatus.revision == revision)
kallithea/model/pull_request.py
Show inline comments
 
@@ -91,10 +91,19 @@ class PullRequestModel(BaseModel):
 
        Session().flush()
 

	
 
        #reset state to under-review
 
        ChangesetStatusModel().set_status(
 
        from kallithea.model.comment import ChangesetCommentsModel
 
        comment = ChangesetCommentsModel().create(
 
            text=u'Auto status change to %s' % (ChangesetStatus.get_status_lbl(ChangesetStatus.STATUS_UNDER_REVIEW)),
 
            repo=org_repo,
 
            status=ChangesetStatus.STATUS_UNDER_REVIEW,
 
            user=new.author,
 
            pull_request=new,
 
            send_email=False
 
        )
 
        ChangesetStatusModel().set_status(
 
            org_repo,
 
            ChangesetStatus.STATUS_UNDER_REVIEW,
 
            new.author,
 
            comment,
 
            pull_request=new
 
        )
 
        self.__add_reviewers(new, reviewers)
0 comments (0 inline, 0 general)