Skip to content

Commit

Permalink
pushlog: guard against _getconn returning None
Browse files Browse the repository at this point in the history
`_getconn` can return `None` in certain scenarios,
so callers should guard against this case instead of
throwing `AttributeError`.

--HG--
extra : amend_source : f1abc4bbd38a6d7ff297b3f4a2de9aba1693f777
  • Loading branch information
cgsheeh committed Apr 22, 2022
1 parent c1dfb4a commit cbca026
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hgext/pushlog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ def recordpush(self, nodes, user, when):
don't have a need to support them, so we error in these scenarios.
'''
c = self._getconn(tr=self.repo._transref())
if not c:
raise error.Abort(b"Could not get sqlite connection to record push.")

# Operate against unfiltered repo so we can insert entries for hidden
# changesets.
Expand Down Expand Up @@ -433,6 +435,8 @@ def recordpushes(self, pushes, tr):
operation to.
"""
c = self._getconn(tr=tr)
if not c:
raise error.Abort(b"Could not get sqlite connection to record push.")

# Operate against unfiltered repo so we can insert entries for hidden
# changesets.
Expand Down

0 comments on commit cbca026

Please sign in to comment.