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

@ -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)

View File

@ -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):

View File

@ -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]))