Details
Details
- Reviewers
durin42 yuja - Group Reviewers
hg-reviewers - Commits
- rHG9e2866065982: py3: use util.forcevytestr to convert error to bytes
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| durin42 | |
| yuja |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/convert/subversion.py (2 lines) | |||
| M | hgext/mq.py (3 lines) | |||
| M | hgext/narrow/narrowbundle2.py (2 lines) | |||
| M | hgext/relink.py (2 lines) |
| svn.ra.get_log(t.ra, paths, start, end, limit, | svn.ra.get_log(t.ra, paths, start, end, limit, | ||||
| discover_changed_paths, | discover_changed_paths, | ||||
| strict_node_history, | strict_node_history, | ||||
| receiver) | receiver) | ||||
| except IOError: | except IOError: | ||||
| # Caller may interrupt the iteration | # Caller may interrupt the iteration | ||||
| pickle.dump(None, fp, protocol) | pickle.dump(None, fp, protocol) | ||||
| except Exception as inst: | except Exception as inst: | ||||
| pickle.dump(str(inst), fp, protocol) | pickle.dump(util.forcebytestr(inst), fp, protocol) | ||||
| else: | else: | ||||
| pickle.dump(None, fp, protocol) | pickle.dump(None, fp, protocol) | ||||
| fp.flush() | fp.flush() | ||||
| # With large history, cleanup process goes crazy and suddenly | # With large history, cleanup process goes crazy and suddenly | ||||
| # consumes *huge* amount of memory. The output file being closed, | # consumes *huge* amount of memory. The output file being closed, | ||||
| # there is no need for clean termination. | # there is no need for clean termination. | ||||
| os._exit(0) | os._exit(0) | ||||
| def removeundo(self, repo): | def removeundo(self, repo): | ||||
| undo = repo.sjoin('undo') | undo = repo.sjoin('undo') | ||||
| if not os.path.exists(undo): | if not os.path.exists(undo): | ||||
| return | return | ||||
| try: | try: | ||||
| os.unlink(undo) | os.unlink(undo) | ||||
| except OSError as inst: | except OSError as inst: | ||||
| self.ui.warn(_('error removing undo: %s\n') % str(inst)) | self.ui.warn(_('error removing undo: %s\n') % \ | ||||
| util.forcebytestr(inst)) | |||||
| def backup(self, repo, files, copy=False): | def backup(self, repo, files, copy=False): | ||||
| # backup local changes in --force case | # backup local changes in --force case | ||||
| for f in sorted(files): | for f in sorted(files): | ||||
| absf = repo.wjoin(f) | absf = repo.wjoin(f) | ||||
| if os.path.lexists(absf): | if os.path.lexists(absf): | ||||
| self.ui.note(_('saving current version of %s as %s\n') % | self.ui.note(_('saving current version of %s as %s\n') % | ||||
| (f, scmutil.origpath(self.ui, repo, f))) | (f, scmutil.origpath(self.ui, repo, f))) | ||||
| # 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))) | ||||
| # Remove partial backup only if there were no exceptions | # Remove partial backup only if there were no exceptions | ||||
| vfs.unlink(chgrpfile) | vfs.unlink(chgrpfile) | ||||
| def setup(): | def setup(): | ||||
| """Enable narrow repo support in bundle2-related extension points.""" | """Enable narrow repo support in bundle2-related extension points.""" | ||||
| extensions.wrapfunction(bundle2, 'getrepocaps', getrepocaps_narrow) | extensions.wrapfunction(bundle2, 'getrepocaps', getrepocaps_narrow) | ||||
| ui.debug('not linkable: %s\n' % f) | ui.debug('not linkable: %s\n' % f) | ||||
| continue | continue | ||||
| try: | try: | ||||
| relinkfile(source, tgt) | relinkfile(source, tgt) | ||||
| ui.progress(_('relinking'), pos, f, _('files'), total) | ui.progress(_('relinking'), pos, f, _('files'), total) | ||||
| relinked += 1 | relinked += 1 | ||||
| savedbytes += sz | savedbytes += sz | ||||
| except OSError as inst: | except OSError as inst: | ||||
| ui.warn('%s: %s\n' % (tgt, str(inst))) | ui.warn('%s: %s\n' % (tgt, util.forcebytestr(inst))) | ||||
| ui.progress(_('relinking'), None) | ui.progress(_('relinking'), None) | ||||
| ui.status(_('relinked %d files (%s reclaimed)\n') % | ui.status(_('relinked %d files (%s reclaimed)\n') % | ||||
| (relinked, util.bytecount(savedbytes))) | (relinked, util.bytecount(savedbytes))) | ||||