--- a/hgext/githelp.py Wed Feb 14 17:43:33 2018 +0530
+++ b/hgext/githelp.py Sun Feb 11 17:23:58 2018 -0800
@@ -22,6 +22,7 @@
from mercurial.i18n import _
from mercurial import (
+ encoding,
error,
fancyopts,
registrar,
@@ -109,7 +110,7 @@
self.args = []
self.opts = {}
- def __str__(self):
+ def __bytes__(self):
cmd = "hg " + self.name
if self.opts:
for k, values in sorted(self.opts.iteritems()):
@@ -123,6 +124,8 @@
cmd += " ".join(self.args)
return cmd
+ __str__ = encoding.strmethod(__bytes__)
+
def append(self, value):
self.args.append(value)
@@ -167,14 +170,14 @@
ui.status(_("note: use hg addremove to remove files that have "
"been deleted.\n\n"))
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def am(ui, repo, *args, **kwargs):
cmdoptions=[
]
args, opts = parseoptions(ui, cmdoptions, args)
cmd = Command('import')
- ui.status(str(cmd), "\n")
+ ui.status(bytes(cmd), "\n")
def apply(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -187,7 +190,7 @@
cmd['-p'] = opts.get('p')
cmd.extend(args)
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def bisect(ui, repo, *args, **kwargs):
ui.status(_("See 'hg help bisect' for how to use bisect.\n\n"))
@@ -198,7 +201,7 @@
args, opts = parseoptions(ui, cmdoptions, args)
cmd = Command('annotate -udl')
cmd.extend([convert(v) for v in args])
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def branch(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -239,7 +242,7 @@
cmd.append(args[0])
elif len(args) == 1:
cmd.append(args[0])
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def ispath(repo, string):
"""
@@ -330,7 +333,7 @@
else:
raise error.Abort("a commit must be specified")
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def cherrypick(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -352,7 +355,7 @@
else:
cmd.extend(args)
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def clean(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -367,7 +370,7 @@
cmd['--all'] = None
cmd.extend(args)
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def clone(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -397,7 +400,7 @@
cocmd.append(opts.get('branch'))
cmd = cmd & cocmd
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def commit(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -445,7 +448,7 @@
cmd.extend(args)
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def deprecated(ui, repo, *args, **kwargs):
ui.warn(_('This command has been deprecated in the git project, ' +
@@ -476,7 +479,7 @@
except Exception:
cmd.append(a)
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def difftool(ui, repo, *args, **kwargs):
ui.status(_('Mercurial does not enable external difftool by default. You '
@@ -509,7 +512,7 @@
else:
cmd['-r'] = v
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def grep(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -522,7 +525,7 @@
# pattern first, followed by paths.
cmd.extend(args)
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def init(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -534,7 +537,7 @@
if len(args) > 0:
cmd.append(args[0])
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def log(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -588,7 +591,7 @@
del args[0]
cmd.extend(args)
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def lsfiles(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -624,7 +627,7 @@
for include in args:
cmd['-I'] = util.shellquote(include)
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def merge(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -636,7 +639,7 @@
if len(args) > 0:
cmd.append(args[len(args) - 1])
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def mergebase(ui, repo, *args, **kwargs):
cmdoptions = []
@@ -650,7 +653,7 @@
ui.status(_('NOTE: ancestors() is part of the revset language.\n'),
_("Learn more about revsets with 'hg help revsets'\n\n"))
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def mergetool(ui, repo, *args, **kwargs):
cmdoptions = []
@@ -661,7 +664,7 @@
if len(args) == 0:
cmd['--all'] = None
cmd.extend(args)
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def mv(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -675,7 +678,7 @@
if opts.get('force'):
cmd['-f'] = None
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def pull(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -701,7 +704,7 @@
else:
cmd['-r'] = v
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def push(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -728,7 +731,7 @@
if opts.get('force'):
cmd['-f'] = None
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def rebase(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -748,12 +751,12 @@
if len(args) > 0:
ui.status(_("also note: 'hg histedit' will automatically detect"
" your stack, so no second argument is necessary.\n\n"))
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
return
if opts.get('skip'):
cmd = Command('revert --all -r .')
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
cmd = Command('rebase')
@@ -777,7 +780,7 @@
cmd['-d'] = convert(args[0])
cmd['-b'] = convert(args[1])
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def reflog(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -791,7 +794,7 @@
if len(args) > 0:
cmd.append(args[0])
- ui.status(str(cmd), "\n\n")
+ ui.status(bytes(cmd), "\n\n")
ui.status(_("note: in hg commits can be deleted from repo but we always"
" have backups.\n"))
@@ -819,7 +822,7 @@
cmd.append(commit)
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def revert(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -834,7 +837,7 @@
if args:
cmd.append(args[0])
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def revparse(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -847,7 +850,7 @@
cmd = Command('root')
if opts.get('show_cdup'):
ui.status(_("note: hg root prints the root of the repository\n\n"))
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
else:
ui.status(_("note: see hg help revset for how to refer to commits\n"))
@@ -866,7 +869,7 @@
if opts.get('dry_run'):
cmd['-n'] = None
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def show(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -898,7 +901,7 @@
else:
cmd = Command('export')
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def stash(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -934,7 +937,7 @@
elif len(args) > 1:
cmd['--name'] = args[1]
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def status(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -948,7 +951,7 @@
if opts.get('ignored'):
cmd['-i'] = None
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def svn(ui, repo, *args, **kwargs):
svncmd = args[0]
@@ -965,7 +968,7 @@
cmd = Command('push')
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def svnfetch(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -975,7 +978,7 @@
cmd = Command('pull')
cmd.append('default-push')
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def svnfindrev(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -985,7 +988,7 @@
cmd = Command('log')
cmd['-r'] = args[0]
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def svnrebase(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -1000,7 +1003,7 @@
cmd = pullcmd & rebasecmd
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
def tag(ui, repo, *args, **kwargs):
cmdoptions = [
@@ -1024,7 +1027,7 @@
if opts.get('force'):
cmd['-f'] = None
- ui.status((str(cmd)), "\n")
+ ui.status((bytes(cmd)), "\n")
gitcommands = {
'add': add,