[PATCH 1 of 2] pullrequsts: really create a comment when creating a PR and setting status to 'under review'

Mads Kiilerich mads at kiilerich.com
Thu Jun 18 13:58:25 EDT 2015

# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1434647232 -7200
#      Thu Jun 18 19:07:12 2015 +0200
# Node ID 7b75c8877364c24c72281759d9959255def3b159
# Parent  5fb4e6f884cec710b34736756d4eadaa53dd51d0
pullrequsts: really create a comment when creating a PR and setting status to 'under review'

14d75d4b03cd changed the pullrequest creation status change comment text from
redundant blurb to just an empty string. Empty comments are however only
created if changing the status ... and in this case we didn't tell the comment
creator that it actually was a status change.

As a result of this, we ended up breaking the implicit invariant that all
status updates have a comment. That showed up as errors dereferencing None when
displaying changesets.

diff --git a/kallithea/model/comment.py b/kallithea/model/comment.py
--- a/kallithea/model/comment.py
+++ b/kallithea/model/comment.py
@@ -170,7 +170,7 @@ class ChangesetCommentsModel(BaseModel):
         if not status_change and not text:
             log.warning('Missing text for comment, skipping...')
-            return
+            return None
         repo = self._get_repo(repo)
         user = self._get_user(user)
diff --git a/kallithea/model/pull_request.py b/kallithea/model/pull_request.py
--- a/kallithea/model/pull_request.py
+++ b/kallithea/model/pull_request.py
@@ -97,7 +97,8 @@ class PullRequestModel(BaseModel):
-            send_email=False
+            send_email=False,
+            status_change=ChangesetStatus.STATUS_UNDER_REVIEW,

More information about the kallithea-general mailing list