diff --git a/method/cvs.py b/method/cvs.py index d611ee8..ac5b39b 100644 --- a/method/cvs.py +++ b/method/cvs.py @@ -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): diff --git a/method/svn.py b/method/svn.py index 873ff49..631b0bd 100644 --- a/method/svn.py +++ b/method/svn.py @@ -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):