#8571 merge request error on can_merge_cache_key

unreleased
open
nobody
None
General
nobody
2024-12-12
2024-12-12
No

If a repo's branches are stale (needs a "refresh"), or the merge request refers to a branch that no longer exists then we get this error:

File '/var/local/allura/Allura/allura/controllers/repository.py', line 434 in index
  can_merge=self.req.can_merge(),
File '/var/local/allura/Allura/allura/model/repository.py', line 964 in can_merge
  cached = self.get_can_merge_cache()
File '/var/local/allura/Allura/allura/model/repository.py', line 943 in get_can_merge_cache
  key = self.can_merge_cache_key()
File '/var/local/allura/Allura/allura/model/repository.py', line 937 in can_merge_cache_key
  target_hash = self.app.repo.commit(self.target_branch)._id
AttributeError: 'NoneType' object has no attribute '_id'

Can we avoid this error, and instead show a message on the page? (might even show a message already if we can get past this error)

Discussion


Log in to post a comment.