fix bugs in vc-blame and create hg-blame
--HG-- branch : pmacs2
This commit is contained in:
parent
637aa1f610
commit
9d4dd2c2d8
17
method/hg.py
17
method/hg.py
|
@ -1,10 +1,17 @@
|
|||
from method import Method, Argument
|
||||
from subprocess import Popen, PIPE, STDOUT
|
||||
|
||||
class HgBlame(Method):
|
||||
from method import Method, Argument
|
||||
from method.vc import VcBlame
|
||||
import re
|
||||
|
||||
class HgBlame(VcBlame):
|
||||
"""Show buffer annotated with hg metadata"""
|
||||
# use hg blame -udq FILE
|
||||
def _execute(self, w, **vargs):
|
||||
w.set_error("unimplemented")
|
||||
line_re = re.compile(r'^ *(?P<user>[^ ]+) (?P<rev>\d+) (?P<date>\d{4}-\d{2}-\d{2}): (?P<content>.*)\n$')
|
||||
prefix_fmt = '[b:d:*]%(rev)-5s [c:d:*]%(user)-10s [b:d:*]%(date)10s[d:d:*]'
|
||||
_is_method = True
|
||||
def _open_pipe(self, w, **vargs):
|
||||
cmd = ("hg", 'blame', '-nudq', w.buffer.path)
|
||||
return Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||
|
||||
class HgLog(Method):
|
||||
"""Show hg log for this buffer"""
|
||||
|
|
|
@ -3,6 +3,8 @@ import buffer.color
|
|||
import util
|
||||
import lex
|
||||
|
||||
class VcException(Exception): pass
|
||||
|
||||
class VcBlame(Method):
|
||||
_is_method = False
|
||||
line_re = None
|
||||
|
@ -10,7 +12,7 @@ class VcBlame(Method):
|
|||
def _filter(self, line):
|
||||
m = self.line_re.match(line)
|
||||
if not m:
|
||||
raise SvnException("couldn't parse %r" % line)
|
||||
raise VcException("couldn't parse %r" % line)
|
||||
return m.groupdict()
|
||||
def _open_pipe(self, w, **vargs):
|
||||
raise Exception('unimplemented')
|
||||
|
|
Loading…
Reference in New Issue