switched cvs-blame and svn-blame to use colors

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-03-31 18:11:13 +00:00
parent 1c7ce79bbb
commit 99645692d4
2 changed files with 1 additions and 65 deletions

View File

@ -184,45 +184,6 @@ class CvsDiff3(Method):
w.set_error("Differences were found")
class CvsBlame(Method):
'''show blame output for the current version in SVN'''
line_re = re.compile('^([0-9.]+) +\(*([a-zA-Z0-9_]+) +([-0-9A-Za-z]+)\): (.*)$')
def _execute(self, w, **vargs):
if not hasattr(w.buffer, 'path'):
w.set_error("Buffer has no corresponding file")
return
cwd = os.getcwd() + os.path.sep
path = w.buffer.path
if path.startswith(cwd):
path = path[len(cwd):]
cmd = ("/usr/bin/cvs", 'annotate', path)
pipe = Popen(cmd, stdout=PIPE, stderr=PIPE)
tokens = []
max_rev = 0
max_user = 0
for line in pipe.stdout:
m = self.line_re.match(line)
if not m:
raise Exception, line
(rev, user, date, content) = m.groups()
max_rev = max(max_rev, len(rev))
max_user = max(max_user, len(user))
tokens.append((rev, user, date, content))
lines = []
fmt = "%%-%ds %%-%ds %%9s %%s\n" % (max_rev, max_user)
for (rev, user, date, content) in tokens:
lines.append(fmt % (rev, user, date, content))
data = ''.join(lines)
status = pipe.wait() >> 8
if status == 0:
w.application.data_buffer("*Blame*", data, switch_to=True, modename='blame')
else:
w.set_error("There was an error (%s)" % (status))
class CvsBlame2(Method):
'''show blame output for the current version in SVN'''
line_re = re.compile('^([0-9.]+) +\(*([a-zA-Z0-9_]+) +([-0-9A-Za-z]+)\): (.*)$')
def _execute(self, w, **vargs):

View File

@ -157,33 +157,8 @@ class SvnDiff3(Method):
w.set_error("Differences were found")
else:
w.set_error("No difference found")
class SvnBlame(Method):
'''show blame output for the current version in SVN'''
line_re = re.compile('^ *(\d+) *([a-zA-Z0-9_]+) *([-0-9]+) *([:0-9]+) *(-\d{4}) *\(([^\)]+)\) (.*)$')
def _execute(self, w, **vargs):
if not hasattr(w.buffer, 'path'):
w.set_error("Buffer has no corresponding file")
return
cmd = ("/usr/bin/svn", 'blame', '-v', w.buffer.path)
pipe = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
lines = []
for line in pipe.stdout:
m = self.line_re.match(line)
if not m:
raise Exception, line
(rev, user, date, t, tz, vdate, content) = m.groups()
lines.append("%-4s %-10s %10s %s\n" % (rev, user, date, content))
data = ''.join(lines)
status = pipe.wait() >> 8
if status == 0:
w.application.data_buffer("*Blame*", data, switch_to=True, modename='blame')
else:
w.set_error("There was an error (%s)" % (status))
class SvnBlame2(Method):
'''show blame output for the current version in SVN'''
line_re = re.compile('^ *(\d+) *([a-zA-Z0-9_]+) *([-0-9]+) *([:0-9]+) *(-\d{4}) *\(([^\)]+)\) (.*)\n$')
def _execute(self, w, **vargs):