# HG changeset patch # User Martin von Zweigbergk # Date 2023-11-13 17:19:11 # Node ID de9cbc5a14505cc408eade49cc8f53134fc35afe # Parent d45afa07564c3d24a5f7dfc35652cd02af660454 py3: pass unicode strings to hasattr() throughout I guess we missed these instances because they're not covered by tests. This is a graft of 1625fe807c04a490f9516bc8e14140e570c06146 that landed on default. diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -198,9 +198,9 @@ def createlog(ui, directory=None, root=b oldlog = pickle.load(open(cachefile, b'rb')) for e in oldlog: if not ( - hasattr(e, b'branchpoints') - and hasattr(e, b'commitid') - and hasattr(e, b'mergepoint') + hasattr(e, 'branchpoints') + and hasattr(e, 'commitid') + and hasattr(e, 'mergepoint') ): ui.status(_(b'ignoring old cache\n')) oldlog = [] diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py --- a/hgext/fsmonitor/__init__.py +++ b/hgext/fsmonitor/__init__.py @@ -332,7 +332,7 @@ def overridewalk(orig, self, match, subr matchfn = match.matchfn matchalways = match.always() dmap = self._map - if hasattr(dmap, b'_map'): + if hasattr(dmap, '_map'): # for better performance, directly access the inner dirstate map if the # standard dirstate implementation is in use. dmap = dmap._map @@ -744,7 +744,7 @@ def makedirstate(repo, dirstate): def wrapdirstate(orig, self): ds = orig(self) # only override the dirstate when Watchman is available for the repo - if hasattr(self, b'_fsmonitorstate'): + if hasattr(self, '_fsmonitorstate'): makedirstate(self, ds) return ds @@ -811,7 +811,7 @@ class state_update: self.oldnode = self.repo[b'.'].node() if self.repo.currentwlock() is None: - if hasattr(self.repo, b'wlocknostateupdate'): + if hasattr(self.repo, 'wlocknostateupdate'): self._lock = self.repo.wlocknostateupdate() else: self._lock = self.repo.wlock() @@ -839,7 +839,7 @@ class state_update: self._lock.release() def _state(self, cmd, commithash, status=b'ok'): - if not hasattr(self.repo, b'_watchmanclient'): + if not hasattr(self.repo, '_watchmanclient'): return False try: self.repo._watchmanclient.command( diff --git a/hgext/remotefilelog/basestore.py b/hgext/remotefilelog/basestore.py --- a/hgext/remotefilelog/basestore.py +++ b/hgext/remotefilelog/basestore.py @@ -415,7 +415,7 @@ class baseunionstore: def markforrefresh(self): for store in self.stores: - if hasattr(store, b'markforrefresh'): + if hasattr(store, 'markforrefresh'): store.markforrefresh() @staticmethod diff --git a/hgext/remotefilelog/fileserverclient.py b/hgext/remotefilelog/fileserverclient.py --- a/hgext/remotefilelog/fileserverclient.py +++ b/hgext/remotefilelog/fileserverclient.py @@ -641,7 +641,7 @@ class fileserverclient: self._lfsprefetch(fileids) def _lfsprefetch(self, fileids): - if not _lfsmod or not hasattr(self.repo.svfs, b'lfslocalblobstore'): + if not _lfsmod or not hasattr(self.repo.svfs, 'lfslocalblobstore'): return if not _lfsmod.wrapper.candownload(self.repo): return