Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/pvec.py @ 50951:d718eddf01d9
safehasattr: drop usage in favor of hasattr
The two functions should now be equivalent at least in their usage in core.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 31 Aug 2023 23:56:15 +0200 |
parents | d44e3c45f0e4 |
children | f15cb5111a1e |
comparison
equal
deleted
inserted
replaced
50950:7a8ea1397816 | 50951:d718eddf01d9 |
---|---|
157 | 157 |
158 | 158 |
159 def ctxpvec(ctx): | 159 def ctxpvec(ctx): |
160 '''construct a pvec for ctx while filling in the cache''' | 160 '''construct a pvec for ctx while filling in the cache''' |
161 r = ctx.repo() | 161 r = ctx.repo() |
162 if not util.safehasattr(r, "_pveccache"): | 162 if not hasattr(r, "_pveccache"): |
163 r._pveccache = {} | 163 r._pveccache = {} |
164 pvc = r._pveccache | 164 pvc = r._pveccache |
165 if ctx.rev() not in pvc: | 165 if ctx.rev() not in pvc: |
166 cl = r.changelog | 166 cl = r.changelog |
167 for n in range(ctx.rev() + 1): | 167 for n in range(ctx.rev() + 1): |