# HG changeset patch # User Anton Shestakov # Date 1579625321 -25200 # Node ID 39029a6d33d4e4ba354cbad3674c3f9b702698ee # Parent 47f9ba943bb18ba4407d501b9eab22bad3198b77 obsdiscovery: compatibility when importing forcebytestr() diff -r 47f9ba943bb1 -r 39029a6d33d4 hgext3rd/evolve/obsdiscovery.py --- a/hgext3rd/evolve/obsdiscovery.py Mon Jan 20 22:52:05 2020 +0700 +++ b/hgext3rd/evolve/obsdiscovery.py Tue Jan 21 23:48:41 2020 +0700 @@ -33,7 +33,12 @@ util, ) from mercurial.i18n import _ -from mercurial.utils import stringutil + +try: + from mercurial.utils.stringutil import forcebytestr +except ImportError: + # hg <= 4.5 (f99d64e8a4e4) + from mercurial.util import forcebytestr from . import ( compat, @@ -450,7 +455,7 @@ except (sqlite3.DatabaseError, sqlite3.OperationalError) as exc: repo.ui.log(b'evoext-cache', b'error while updating obshashrange cache: %s' - % stringutil.forcebytestr(exc)) + % forcebytestr(exc)) del self._updating return @@ -556,9 +561,9 @@ self._new.clear() repo.ui.log(b'evoext-cache', b'error while saving new data: %s' - % stringutil.forcebytestr(exc)) + % forcebytestr(exc)) repo.ui.debug(b'evoext-cache: error while saving new data: %s' - % stringutil.forcebytestr(exc)) + % forcebytestr(exc)) def _trysave(self, repo): if self._con is None: