Details
Details
- Reviewers
yuja - Group Reviewers
hg-reviewers - Commits
- rHG93943eef696f: py3: use pycompat.byteskwargs in hgext/convert/
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| yuja |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/convert/common.py (2 lines) | |||
| M | hgext/convert/convcmd.py (1 line) | |||
| M | hgext/convert/cvsps.py (1 line) | |||
| M | hgext/convert/monotone.py (2 lines) |
| import re | import re | ||||
| import subprocess | import subprocess | ||||
| from mercurial.i18n import _ | from mercurial.i18n import _ | ||||
| from mercurial import ( | from mercurial import ( | ||||
| encoding, | encoding, | ||||
| error, | error, | ||||
| phases, | phases, | ||||
| pycompat, | |||||
| util, | util, | ||||
| ) | ) | ||||
| pickle = util.pickle | pickle = util.pickle | ||||
| propertycache = util.propertycache | propertycache = util.propertycache | ||||
| def encodeargs(args): | def encodeargs(args): | ||||
| def encodearg(s): | def encodearg(s): | ||||
| def prerun(self): | def prerun(self): | ||||
| pass | pass | ||||
| def postrun(self): | def postrun(self): | ||||
| pass | pass | ||||
| def _cmdline(self, cmd, *args, **kwargs): | def _cmdline(self, cmd, *args, **kwargs): | ||||
| kwargs = pycompat.byteskwargs(kwargs) | |||||
| cmdline = [self.command, cmd] + list(args) | cmdline = [self.command, cmd] + list(args) | ||||
| for k, v in kwargs.iteritems(): | for k, v in kwargs.iteritems(): | ||||
| if len(k) == 1: | if len(k) == 1: | ||||
| cmdline.append('-' + k) | cmdline.append('-' + k) | ||||
| else: | else: | ||||
| cmdline.append('--' + k.replace('_', '-')) | cmdline.append('--' + k.replace('_', '-')) | ||||
| try: | try: | ||||
| if len(k) == 1: | if len(k) == 1: | ||||
| def cleanup(self): | def cleanup(self): | ||||
| try: | try: | ||||
| self.dest.after() | self.dest.after() | ||||
| finally: | finally: | ||||
| self.source.after() | self.source.after() | ||||
| self.map.close() | self.map.close() | ||||
| def convert(ui, src, dest=None, revmapfile=None, **opts): | def convert(ui, src, dest=None, revmapfile=None, **opts): | ||||
| opts = pycompat.byteskwargs(opts) | |||||
| global orig_encoding | global orig_encoding | ||||
| orig_encoding = encoding.encoding | orig_encoding = encoding.encoding | ||||
| encoding.encoding = 'UTF-8' | encoding.encoding = 'UTF-8' | ||||
| # support --authors as an alias for --authormap | # support --authors as an alias for --authormap | ||||
| if not opts.get('authormap'): | if not opts.get('authormap'): | ||||
| opts['authormap'] = opts.get('authors') | opts['authormap'] = opts.get('authors') | ||||
| return changesets | return changesets | ||||
| def debugcvsps(ui, *args, **opts): | def debugcvsps(ui, *args, **opts): | ||||
| '''Read CVS rlog for current directory or named path in | '''Read CVS rlog for current directory or named path in | ||||
| repository, and convert the log to changesets based on matching | repository, and convert the log to changesets based on matching | ||||
| commit log entries and dates. | commit log entries and dates. | ||||
| ''' | ''' | ||||
| opts = pycompat.byteskwargs(opts) | |||||
| if opts["new_cache"]: | if opts["new_cache"]: | ||||
| cache = "write" | cache = "write" | ||||
| elif opts["update_cache"]: | elif opts["update_cache"]: | ||||
| cache = "update" | cache = "update" | ||||
| else: | else: | ||||
| cache = None | cache = None | ||||
| revisions = opts["revisions"] | revisions = opts["revisions"] | ||||
| # monotone.py - monotone support for the convert extension | # monotone.py - monotone support for the convert extension | ||||
| # | # | ||||
| # Copyright 2008, 2009 Mikkel Fahnoe Jorgensen <mikkel@dvide.com> and | # Copyright 2008, 2009 Mikkel Fahnoe Jorgensen <mikkel@dvide.com> and | ||||
| # others | # others | ||||
| # | # | ||||
| # This software may be used and distributed according to the terms of the | # This software may be used and distributed according to the terms of the | ||||
| # GNU General Public License version 2 or any later version. | # GNU General Public License version 2 or any later version. | ||||
| from __future__ import absolute_import | from __future__ import absolute_import | ||||
| import os | import os | ||||
| import re | import re | ||||
| from mercurial.i18n import _ | from mercurial.i18n import _ | ||||
| from mercurial import ( | from mercurial import ( | ||||
| error, | error, | ||||
| pycompat, | |||||
| util, | util, | ||||
| ) | ) | ||||
| from . import common | from . import common | ||||
| class monotone_source(common.converter_source, common.commandline): | class monotone_source(common.converter_source, common.commandline): | ||||
| def __init__(self, ui, repotype, path=None, revs=None): | def __init__(self, ui, repotype, path=None, revs=None): | ||||
| common.converter_source.__init__(self, ui, repotype, path, revs) | common.converter_source.__init__(self, ui, repotype, path, revs) | ||||
| return self.mtnrunsingle(*args, **kwargs) | return self.mtnrunsingle(*args, **kwargs) | ||||
| def mtnrunsingle(self, *args, **kwargs): | def mtnrunsingle(self, *args, **kwargs): | ||||
| kwargs['d'] = self.path | kwargs['d'] = self.path | ||||
| return self.run0('automate', *args, **kwargs) | return self.run0('automate', *args, **kwargs) | ||||
| def mtnrunstdio(self, *args, **kwargs): | def mtnrunstdio(self, *args, **kwargs): | ||||
| # Prepare the command in automate stdio format | # Prepare the command in automate stdio format | ||||
| kwargs = pycompat.byteskwargs(kwargs) | |||||
| command = [] | command = [] | ||||
| for k, v in kwargs.iteritems(): | for k, v in kwargs.iteritems(): | ||||
| command.append("%s:%s" % (len(k), k)) | command.append("%s:%s" % (len(k), k)) | ||||
| if v: | if v: | ||||
| command.append("%s:%s" % (len(v), v)) | command.append("%s:%s" % (len(v), v)) | ||||
| if command: | if command: | ||||
| command.insert(0, 'o') | command.insert(0, 'o') | ||||
| command.append('e') | command.append('e') | ||||