Mercurial > evolve
changeset 5137:4fef6b157175 stable
py3-exceptions: wrap more Exceptions in forcebytestr before formatting
author | willstott101@gmail.com |
---|---|
date | Mon, 02 Mar 2020 17:12:09 +0000 |
parents | f93bf36d0c19 |
children | b8b234123fe6 |
files | hgext3rd/evolve/depthcache.py hgext3rd/evolve/firstmergecache.py hgext3rd/evolve/obscache.py hgext3rd/evolve/stablerangecache.py hgext3rd/evolve/stablesort.py |
diffstat | 5 files changed, 40 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/depthcache.py Sat Feb 22 18:36:32 2020 +0100 +++ b/hgext3rd/evolve/depthcache.py Mon Mar 02 17:12:09 2020 +0000 @@ -16,6 +16,12 @@ scmutil, ) +try: + from mercurial.utils.stringutil import forcebytestr +except ImportError: + # hg <= 4.5 (f99d64e8a4e4) + from mercurial.util import forcebytestr + from . import ( compat, error, @@ -206,5 +212,5 @@ cachefile.close() self._ondiskkey = self._cachekey except (IOError, OSError) as exc: - repo.ui.log(b'depthcache', b'could not write update %s\n' % exc) - repo.ui.debug(b'depthcache: could not write update %s\n' % exc) + repo.ui.log(b'depthcache', b'could not write update %s\n' % forcebytestr(exc)) + repo.ui.debug(b'depthcache: could not write update %s\n' % forcebytestr(exc))
--- a/hgext3rd/evolve/firstmergecache.py Sat Feb 22 18:36:32 2020 +0100 +++ b/hgext3rd/evolve/firstmergecache.py Mon Mar 02 17:12:09 2020 +0000 @@ -16,6 +16,12 @@ node as nodemod, ) +try: + from mercurial.utils.stringutil import forcebytestr +except ImportError: + # hg <= 4.5 (f99d64e8a4e4) + from mercurial.util import forcebytestr + from . import ( compat, error, @@ -143,5 +149,5 @@ cachefile.close() self._ondiskkey = self._cachekey except (IOError, OSError) as exc: - repo.ui.log(b'firstmergecache', b'could not write update %s\n' % exc) - repo.ui.debug(b'firstmergecache: could not write update %s\n' % exc) + repo.ui.log(b'firstmergecache', b'could not write update %s\n' % forcebytestr(exc)) + repo.ui.debug(b'firstmergecache: could not write update %s\n' % forcebytestr(exc))
--- a/hgext3rd/evolve/obscache.py Sat Feb 22 18:36:32 2020 +0100 +++ b/hgext3rd/evolve/obscache.py Mon Mar 02 17:12:09 2020 +0000 @@ -19,6 +19,12 @@ util, ) +try: + from mercurial.utils.stringutil import forcebytestr +except ImportError: + # hg <= 4.5 (f99d64e8a4e4) + from mercurial.util import forcebytestr + from . import ( compat, exthelper, @@ -411,8 +417,8 @@ cachefile.close() self._ondiskkey = self._cachekey except (IOError, OSError) as exc: - repo.ui.log(b'obscache', b'could not write update %s\n' % exc) - repo.ui.debug(b'obscache: could not write update %s\n' % exc) + repo.ui.log(b'obscache', b'could not write update %s\n' % forcebytestr(exc)) + repo.ui.debug(b'obscache: could not write update %s\n' % forcebytestr(exc)) def load(self, repo): """load data from disk"""
--- a/hgext3rd/evolve/stablerangecache.py Sat Feb 22 18:36:32 2020 +0100 +++ b/hgext3rd/evolve/stablerangecache.py Mon Mar 02 17:12:09 2020 +0000 @@ -22,6 +22,12 @@ util, ) +try: + from mercurial.utils.stringutil import forcebytestr +except ImportError: + # hg <= 4.5 (f99d64e8a4e4) + from mercurial.util import forcebytestr + from . import ( compat, exthelper, @@ -282,8 +288,8 @@ if r'_con' in vars(self): del self._con self._unsavedsubranges.clear() - repo.ui.log(b'evoext-cache', b'error while saving new data: %s' % exc) - repo.ui.debug(b'evoext-cache: error while saving new data: %s' % exc) + repo.ui.log(b'evoext-cache', b'error while saving new data: %s' % forcebytestr(exc)) + repo.ui.debug(b'evoext-cache: error while saving new data: %s' % forcebytestr(exc)) def _trysave(self, repo): repo = repo.unfiltered()
--- a/hgext3rd/evolve/stablesort.py Sat Feb 22 18:36:32 2020 +0100 +++ b/hgext3rd/evolve/stablesort.py Mon Mar 02 17:12:09 2020 +0000 @@ -259,6 +259,12 @@ scmutil, ) +try: + from mercurial.utils.stringutil import forcebytestr +except ImportError: + # hg <= 4.5 (f99d64e8a4e4) + from mercurial.util import forcebytestr + from mercurial.i18n import _ from . import ( @@ -932,8 +938,8 @@ cachefile.close() self._ondiskkey = self._cachekey except (IOError, OSError) as exc: - repo.ui.log(b'stablesortcache', b'could not write update %s\n' % exc) - repo.ui.debug(b'stablesortcache: could not write update %s\n' % exc) + repo.ui.log(b'stablesortcache', b'could not write update %s\n' % forcebytestr(exc)) + repo.ui.debug(b'stablesortcache: could not write update %s\n' % forcebytestr(exc)) @eh.reposetup def setupcache(ui, repo):