Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHGf659a407e5ee: py3: use util.forcebytestr instead of str to convert error messages
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/hg.py (2 lines) | |||
M | mercurial/repair.py (2 lines) | |||
M | mercurial/revlog.py (3 lines) |
if relative: | if relative: | ||||
try: | try: | ||||
sharedpath = os.path.relpath(sharedpath, destvfs.base) | sharedpath = os.path.relpath(sharedpath, destvfs.base) | ||||
requirements += 'relshared\n' | requirements += 'relshared\n' | ||||
except (IOError, ValueError) as e: | except (IOError, ValueError) as e: | ||||
# ValueError is raised on Windows if the drive letters differ on | # ValueError is raised on Windows if the drive letters differ on | ||||
# each path | # each path | ||||
raise error.Abort(_('cannot calculate relative path'), | raise error.Abort(_('cannot calculate relative path'), | ||||
hint=str(e)) | hint=util.forcebytestr(e)) | ||||
else: | else: | ||||
requirements += 'shared\n' | requirements += 'shared\n' | ||||
destvfs.write('requires', requirements) | destvfs.write('requires', requirements) | ||||
destvfs.write('sharedpath', sharedpath) | destvfs.write('sharedpath', sharedpath) | ||||
r = repository(ui, destwvfs.base) | r = repository(ui, destwvfs.base) | ||||
postshare(srcrepo, r, bookmarks=bookmarks, defaultpath=defaultpath) | postshare(srcrepo, r, bookmarks=bookmarks, defaultpath=defaultpath) |
# remove undo files | # remove undo files | ||||
for undovfs, undofile in repo.undofiles(): | for undovfs, undofile in repo.undofiles(): | ||||
try: | try: | ||||
undovfs.unlink(undofile) | undovfs.unlink(undofile) | ||||
except OSError as e: | except OSError as e: | ||||
if e.errno != errno.ENOENT: | if e.errno != errno.ENOENT: | ||||
ui.warn(_('error removing %s: %s\n') % | ui.warn(_('error removing %s: %s\n') % | ||||
(undovfs.join(undofile), str(e))) | (undovfs.join(undofile), util.forcebytestr(e))) | ||||
except: # re-raises | except: # re-raises | ||||
if backupfile: | if backupfile: | ||||
ui.warn(_("strip failed, backup bundle stored in '%s'\n") | ui.warn(_("strip failed, backup bundle stored in '%s'\n") | ||||
% vfs.join(backupfile)) | % vfs.join(backupfile)) | ||||
if tmpbundlefile: | if tmpbundlefile: | ||||
ui.warn(_("strip failed, unrecovered changes stored in '%s'\n") | ui.warn(_("strip failed, unrecovered changes stored in '%s'\n") | ||||
% vfs.join(tmpbundlefile)) | % vfs.join(tmpbundlefile)) |
# According to `hg perfrevlogchunks`, this is ~0.5% faster for zlib | # According to `hg perfrevlogchunks`, this is ~0.5% faster for zlib | ||||
# compressed chunks. And this matters for changelog and manifest reads. | # compressed chunks. And this matters for changelog and manifest reads. | ||||
t = data[0:1] | t = data[0:1] | ||||
if t == 'x': | if t == 'x': | ||||
try: | try: | ||||
return _zlibdecompress(data) | return _zlibdecompress(data) | ||||
except zlib.error as e: | except zlib.error as e: | ||||
raise RevlogError(_('revlog decompress error: %s') % str(e)) | raise RevlogError(_('revlog decompress error: %s') % | ||||
util.forcebytestr(e)) | |||||
# '\0' is more common than 'u' so it goes first. | # '\0' is more common than 'u' so it goes first. | ||||
elif t == '\0': | elif t == '\0': | ||||
return data | return data | ||||
elif t == 'u': | elif t == 'u': | ||||
return util.buffer(data, 1) | return util.buffer(data, 1) | ||||
try: | try: | ||||
compressor = self._decompressors[t] | compressor = self._decompressors[t] |