From 15d4e61f65b0a111cdfb626c9d83f9db1b448050 Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Thu, 3 Sep 2020 23:50:36 -0400 Subject: [PATCH] fix git, try to fix hg --HG-- branch : pmacs2 --- application.py | 2 +- method/hg.py | 19 +++++++++++-------- method/tags.py | 2 +- method/vc.py | 3 ++- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/application.py b/application.py index 39e1450..01a7918 100755 --- a/application.py +++ b/application.py @@ -45,7 +45,7 @@ class Application(object): # initialize some basic stuff self.config = {} - self.highlighted_ranges = [] + self.highlighted_ranges = [] self.highlight_mark = False self.mini_active = False self.mini_buffer = None diff --git a/method/hg.py b/method/hg.py index 51b2437..ecd1f5b 100644 --- a/method/hg.py +++ b/method/hg.py @@ -25,7 +25,7 @@ class HgBase(object): def _hg_init(self, **kwargs): ui_imp = ui.ui(**kwargs) ui_imp.pushbuffer() - repo = hg.repository(ui=ui_imp, path='.') + repo = hg.repository(ui=ui_imp, path='.'.encode('UTF-8')) return ui_imp, repo class HgBlame(VcBlame, HgBase): @@ -46,8 +46,8 @@ class HgLog(Method, HgBase): return ui_imp, repo = self._hg_init() hgc.log(ui_imp, repo, user=None, rev=None, date=None) - s = ''.join(ui_imp.popbuffer()) - w.application.data_buffer('*Log*', s, switch_to=True) + output = ui_imp.popbuffer().decode('UTF-8') + w.application.data_buffer('*Log*', output, switch_to=True) class HgInfo(Method, HgBase): """Get some basic info from Mercurial about the current buffer""" @@ -57,12 +57,15 @@ class HgInfo(Method, HgBase): base = os.path.basename(w.buffer.path) ui_imp, repo = self._hg_init() path = w.buffer.path.replace(os.getcwd() + '/', '') - l = repo.file(path) + #l = repo.file(path.encode('UTF-8')) status = 'Unknown' - rev = l.linkrev(l.rev(l.tip())) - ctx = repo[rev] - changeid = node.hex(ctx.node()[:6]) - user = ui_imp.shortuser(ctx.user()) + #rev = l.linkrev(l.rev(l.tip())) + fc = repo.filectx(path.encode('UTF-8'), b'tip') + user = ui_imp.shortuser(fc.user()).decode('UTF-8') + rev = node.hex(fc.node()) + ctx = repo[fc.node()] + changeid = node.hex(ctx.node()[:6]).decode('UTF-8') + #user = ui_imp.shortuser(ctx.user()) msg = '%s %s %s:%s [%s]' % (base, status, rev, changeid, user) w.set_error(msg) diff --git a/method/tags.py b/method/tags.py index c629b21..66b8021 100644 --- a/method/tags.py +++ b/method/tags.py @@ -1,7 +1,7 @@ import os.path from method import Method, arg import completer -from etags import TagManager +#from etags import TagManager import default class TagBase(Method): diff --git a/method/vc.py b/method/vc.py index 4d64fd4..4c7a818 100644 --- a/method/vc.py +++ b/method/vc.py @@ -37,7 +37,8 @@ class VcBlame(Method): pipe = self._open_pipe(w, **vargs) groups = [] gsizes = [0] * self.num_fields - for line in pipe.stdout: + for s in pipe.stdout: + line = s.decode('UTF-8') d = self._filter(line) for i in range(0, self.num_fields): gsizes[i] = max(gsizes[i], len(d['fields'][i]))