mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[FIX] runbot_merge: odd behaviour in try_closing
Could not reproduce it in a shell, but in the original version `self.env.cr.rowcount` would always be 0 after the `modified`. Turns out the check is really completely dumb, because if we got any match in `select for update` we're going to find the same on in the update, and thus the conditional is unnecessary. I've no idea why I did that. Anyway remove the conditional and just always try to unstage the PR.
This commit is contained in:
parent
b0995adda0
commit
dbc001f841
@ -1358,23 +1358,21 @@ class PullRequests(models.Model):
|
|||||||
WHERE id = %s AND state != 'merged'
|
WHERE id = %s AND state != 'merged'
|
||||||
FOR UPDATE SKIP LOCKED;
|
FOR UPDATE SKIP LOCKED;
|
||||||
''', [self.id])
|
''', [self.id])
|
||||||
res = self.env.cr.fetchone()
|
if not self.env.cr.fetchone():
|
||||||
if not res:
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.env.cr.execute('''
|
self.env.cr.execute('''
|
||||||
UPDATE runbot_merge_pull_requests
|
UPDATE runbot_merge_pull_requests
|
||||||
SET state = 'closed'
|
SET state = 'closed'
|
||||||
WHERE id = %s AND state != 'merged'
|
WHERE id = %s
|
||||||
''', [self.id])
|
''', [self.id])
|
||||||
self.env.cr.commit()
|
self.env.cr.commit()
|
||||||
self.modified(['state'])
|
self.modified(['state'])
|
||||||
if self.env.cr.rowcount:
|
self.unstage(
|
||||||
self.unstage(
|
"PR %s closed by %s",
|
||||||
"PR %s closed by %s",
|
self.display_name,
|
||||||
self.display_name,
|
by
|
||||||
by
|
)
|
||||||
)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# state changes on reviews
|
# state changes on reviews
|
||||||
|
Loading…
Reference in New Issue
Block a user