comparison mercurial/patch.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 886d05ed9a46
children 8f629783b8ae 493034cc3265
comparison
equal deleted inserted replaced
50950:7a8ea1397816 50951:d718eddf01d9
166 inheader = False 166 inheader = False
167 cur = [] 167 cur = []
168 168
169 mimeheaders = [b'content-type'] 169 mimeheaders = [b'content-type']
170 170
171 if not util.safehasattr(stream, 'next'): 171 if not hasattr(stream, 'next'):
172 # http responses, for example, have readline but not next 172 # http responses, for example, have readline but not next
173 stream = fiter(stream) 173 stream = fiter(stream)
174 174
175 for line in stream: 175 for line in stream:
176 cur.append(line) 176 cur.append(line)
1701 1701
1702 ''' 1702 '''
1703 1703
1704 newhunks = [] 1704 newhunks = []
1705 for c in hunks: 1705 for c in hunks:
1706 if util.safehasattr(c, 'reversehunk'): 1706 if hasattr(c, 'reversehunk'):
1707 c = c.reversehunk() 1707 c = c.reversehunk()
1708 newhunks.append(c) 1708 newhunks.append(c)
1709 return newhunks 1709 return newhunks
1710 1710
1711 1711