fix git, try to fix hg

--HG--
branch : pmacs2
This commit is contained in:
~d6 2020-09-03 23:50:36 -04:00
parent a221e81e6b
commit 15d4e61f65
4 changed files with 15 additions and 11 deletions

View File

@ -45,7 +45,7 @@ class Application(object):
# initialize some basic stuff # initialize some basic stuff
self.config = {} self.config = {}
self.highlighted_ranges = [] self.highlighted_ranges = []
self.highlight_mark = False self.highlight_mark = False
self.mini_active = False self.mini_active = False
self.mini_buffer = None self.mini_buffer = None

View File

@ -25,7 +25,7 @@ class HgBase(object):
def _hg_init(self, **kwargs): def _hg_init(self, **kwargs):
ui_imp = ui.ui(**kwargs) ui_imp = ui.ui(**kwargs)
ui_imp.pushbuffer() ui_imp.pushbuffer()
repo = hg.repository(ui=ui_imp, path='.') repo = hg.repository(ui=ui_imp, path='.'.encode('UTF-8'))
return ui_imp, repo return ui_imp, repo
class HgBlame(VcBlame, HgBase): class HgBlame(VcBlame, HgBase):
@ -46,8 +46,8 @@ class HgLog(Method, HgBase):
return return
ui_imp, repo = self._hg_init() ui_imp, repo = self._hg_init()
hgc.log(ui_imp, repo, user=None, rev=None, date=None) hgc.log(ui_imp, repo, user=None, rev=None, date=None)
s = ''.join(ui_imp.popbuffer()) output = ui_imp.popbuffer().decode('UTF-8')
w.application.data_buffer('*Log*', s, switch_to=True) w.application.data_buffer('*Log*', output, switch_to=True)
class HgInfo(Method, HgBase): class HgInfo(Method, HgBase):
"""Get some basic info from Mercurial about the current buffer""" """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) base = os.path.basename(w.buffer.path)
ui_imp, repo = self._hg_init() ui_imp, repo = self._hg_init()
path = w.buffer.path.replace(os.getcwd() + '/', '') path = w.buffer.path.replace(os.getcwd() + '/', '')
l = repo.file(path) #l = repo.file(path.encode('UTF-8'))
status = 'Unknown' status = 'Unknown'
rev = l.linkrev(l.rev(l.tip())) #rev = l.linkrev(l.rev(l.tip()))
ctx = repo[rev] fc = repo.filectx(path.encode('UTF-8'), b'tip')
changeid = node.hex(ctx.node()[:6]) user = ui_imp.shortuser(fc.user()).decode('UTF-8')
user = ui_imp.shortuser(ctx.user()) 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) msg = '%s %s %s:%s [%s]' % (base, status, rev, changeid, user)
w.set_error(msg) w.set_error(msg)

View File

@ -1,7 +1,7 @@
import os.path import os.path
from method import Method, arg from method import Method, arg
import completer import completer
from etags import TagManager #from etags import TagManager
import default import default
class TagBase(Method): class TagBase(Method):

View File

@ -37,7 +37,8 @@ class VcBlame(Method):
pipe = self._open_pipe(w, **vargs) pipe = self._open_pipe(w, **vargs)
groups = [] groups = []
gsizes = [0] * self.num_fields gsizes = [0] * self.num_fields
for line in pipe.stdout: for s in pipe.stdout:
line = s.decode('UTF-8')
d = self._filter(line) d = self._filter(line)
for i in range(0, self.num_fields): for i in range(0, self.num_fields):
gsizes[i] = max(gsizes[i], len(d['fields'][i])) gsizes[i] = max(gsizes[i], len(d['fields'][i]))