comparison hgext/convert/subversion.py @ 44970:7a4630536e53 stable

py3: avoid using %r format on bytes Before the patch, the 'b' prefix appeared in the formatted string. Wrapping the bytes as pycompat.bytestr solves this problem. Eventually, I think that we should move away from using %r (like 975e517451a6 and 4d6019c0e0ef did), but that would change output of non-ASCII bytes on Python 2, so we can’t do it on the stable branch. Also, many places continue to use %r, so it would be a good idea to do the change all at once.
author Manuel Jacob <me@manueljacob.de>
date Tue, 16 Jun 2020 14:32:10 +0200
parents d545b895234a
children 423e20c78e6d
comparison
equal deleted inserted replaced
44969:d545b895234a 44970:7a4630536e53
533 raise error.Abort( 533 raise error.Abort(
534 _(b'expected %s to be at %r, but not found') 534 _(b'expected %s to be at %r, but not found')
535 % (name, path) 535 % (name, path)
536 ) 536 )
537 return None 537 return None
538 self.ui.note(_(b'found %s at %r\n') % (name, path)) 538 self.ui.note(
539 _(b'found %s at %r\n') % (name, pycompat.bytestr(path))
540 )
539 return path 541 return path
540 542
541 rev = optrev(self.last_changed) 543 rev = optrev(self.last_changed)
542 oldmodule = b'' 544 oldmodule = b''
543 trunk = getcfgpath(b'trunk', rev) 545 trunk = getcfgpath(b'trunk', rev)
1206 return relative[1:] 1208 return relative[1:]
1207 elif relative == b'': 1209 elif relative == b'':
1208 return relative 1210 return relative
1209 1211
1210 # The path is outside our tracked tree... 1212 # The path is outside our tracked tree...
1211 self.ui.debug(b'%r is not under %r, ignoring\n' % (path, module)) 1213 self.ui.debug(
1214 b'%r is not under %r, ignoring\n'
1215 % (pycompat.bytestr(path), pycompat.bytestr(module))
1216 )
1212 return None 1217 return None
1213 1218
1214 def _checkpath(self, path, revnum, module=None): 1219 def _checkpath(self, path, revnum, module=None):
1215 if module is not None: 1220 if module is not None:
1216 prevmodule = self.reparent(b'') 1221 prevmodule = self.reparent(b'')