Details
Details
- Reviewers
durin42 yuja - Group Reviewers
hg-reviewers - Commits
- rHG2f7a3c90c0d7: py3: use pycompat.bytestr() to convert error messages 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/gpg.py (2 lines) | |||
| M | hgext/journal.py (2 lines) | |||
| M | hgext/largefiles/overrides.py (4 lines) | |||
| M | hgext/mq.py (3 lines) | |||
| M | hgext/narrow/narrowbundle2.py (3 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(pycompat.bytestr(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) | ||||
| % hgnode.short(n) | % hgnode.short(n) | ||||
| for n in nodes]) | for n in nodes]) | ||||
| try: | try: | ||||
| editor = cmdutil.getcommiteditor(editform='gpg.sign', | editor = cmdutil.getcommiteditor(editform='gpg.sign', | ||||
| **pycompat.strkwargs(opts)) | **pycompat.strkwargs(opts)) | ||||
| repo.commit(message, opts['user'], opts['date'], match=msigs, | repo.commit(message, opts['user'], opts['date'], match=msigs, | ||||
| editor=editor) | editor=editor) | ||||
| except ValueError as inst: | except ValueError as inst: | ||||
| raise error.Abort(str(inst)) | raise error.Abort(pycompat.bytestr(inst)) | ||||
| def node2txt(repo, node, ver): | def node2txt(repo, node, ver): | ||||
| """map a manifest into some text""" | """map a manifest into some text""" | ||||
| if ver == "0": | if ver == "0": | ||||
| return "%s\n" % hgnode.hex(node) | return "%s\n" % hgnode.hex(node) | ||||
| else: | else: | ||||
| raise error.Abort(_("unknown signature version")) | raise error.Abort(_("unknown signature version")) | ||||
| if opts.get("commits"): | if opts.get("commits"): | ||||
| displayer = logcmdutil.changesetdisplayer(ui, repo, opts) | displayer = logcmdutil.changesetdisplayer(ui, repo, opts) | ||||
| for hash in entry.newhashes: | for hash in entry.newhashes: | ||||
| try: | try: | ||||
| ctx = repo[hash] | ctx = repo[hash] | ||||
| displayer.show(ctx) | displayer.show(ctx) | ||||
| except error.RepoLookupError as e: | except error.RepoLookupError as e: | ||||
| fm.write('repolookuperror', "%s\n\n", str(e)) | fm.write('repolookuperror', "%s\n\n", pycompat.bytestr(e)) | ||||
| displayer.close() | displayer.close() | ||||
| fm.end() | fm.end() | ||||
| if entry is None: | if entry is None: | ||||
| ui.status(_("no recorded locations\n")) | ui.status(_("no recorded locations\n")) | ||||
| # only match normal files and run it, then replace it to just | # only match normal files and run it, then replace it to just | ||||
| # match largefiles and run it again. | # match largefiles and run it again. | ||||
| nonormalfiles = False | nonormalfiles = False | ||||
| nolfiles = False | nolfiles = False | ||||
| installnormalfilesmatchfn(repo[None].manifest()) | installnormalfilesmatchfn(repo[None].manifest()) | ||||
| try: | try: | ||||
| result = orig(ui, repo, pats, opts, rename) | result = orig(ui, repo, pats, opts, rename) | ||||
| except error.Abort as e: | except error.Abort as e: | ||||
| if str(e) != _('no files to copy'): | if pycompat.bytestr(e) != _('no files to copy'): | ||||
| raise e | raise e | ||||
| else: | else: | ||||
| nonormalfiles = True | nonormalfiles = True | ||||
| result = 0 | result = 0 | ||||
| finally: | finally: | ||||
| restorematchfn() | restorematchfn() | ||||
| # The first rename can cause our current working directory to be removed. | # The first rename can cause our current working directory to be removed. | ||||
| lfdirstate.remove(srclfile) | lfdirstate.remove(srclfile) | ||||
| else: | else: | ||||
| util.copyfile(repo.wjoin(srclfile), | util.copyfile(repo.wjoin(srclfile), | ||||
| repo.wjoin(destlfile)) | repo.wjoin(destlfile)) | ||||
| lfdirstate.add(destlfile) | lfdirstate.add(destlfile) | ||||
| lfdirstate.write() | lfdirstate.write() | ||||
| except error.Abort as e: | except error.Abort as e: | ||||
| if str(e) != _('no files to copy'): | if pycompat.bytestr(e) != _('no files to copy'): | ||||
| raise e | raise e | ||||
| else: | else: | ||||
| nolfiles = True | nolfiles = True | ||||
| finally: | finally: | ||||
| restorematchfn() | restorematchfn() | ||||
| wlock.release() | wlock.release() | ||||
| if nolfiles and nonormalfiles: | if nolfiles and nonormalfiles: | ||||
| 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') % \ | ||||
| pycompat.bytestr(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))) | ||||
| from mercurial import ( | from mercurial import ( | ||||
| bundle2, | bundle2, | ||||
| changegroup, | changegroup, | ||||
| dagutil, | dagutil, | ||||
| error, | error, | ||||
| exchange, | exchange, | ||||
| extensions, | extensions, | ||||
| narrowspec, | narrowspec, | ||||
| pycompat, | |||||
| repair, | repair, | ||||
| util, | util, | ||||
| wireproto, | wireproto, | ||||
| ) | ) | ||||
| NARROWCAP = 'narrow' | NARROWCAP = 'narrow' | ||||
| _NARROWACL_SECTION = 'narrowhgacl' | _NARROWACL_SECTION = 'narrowhgacl' | ||||
| _CHANGESPECPART = NARROWCAP + ':changespec' | _CHANGESPECPART = NARROWCAP + ':changespec' | ||||
| # 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), pycompat.bytestr(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, pycompat.bytestr(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))) | ||||