cvs-blame2 added

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-07-20 19:08:27 -04:00
parent 12c62a423c
commit e8d4bcbc7e
1 changed files with 21 additions and 7 deletions

View File

@ -209,19 +209,25 @@ class CvsDiff3(Method):
w.set_error("Differences were found") w.set_error("Differences were found")
class CvsBlame(Method): class CvsBlame(Method):
'''show blame output for the current version in SVN''' '''show blame output for the current version in CVS'''
line_re = re.compile('^([0-9.]+) +\(*([a-zA-Z0-9_]+) +([-0-9A-Za-z]+)\): (.*)$') line_re = re.compile('^([0-9.]+) +\(*([a-zA-Z0-9_]+) +([-0-9A-Za-z]+)\): (.*)$')
def _get_path(self, w, **vargs):
cwd = os.getcwd() + os.path.sep
path = w.buffer.path
if path.startswith(cwd):
path = path[len(cwd):]
return path
def _get_cmd(self, w, **vargs):
path = self._get_path(w, **vargs)
return ("/usr/bin/cvs", 'annotate', path)
def _execute(self, w, **vargs): def _execute(self, w, **vargs):
if not hasattr(w.buffer, 'path'): if not hasattr(w.buffer, 'path'):
w.set_error("Buffer has no corresponding file") w.set_error("Buffer has no corresponding file")
return return
cwd = os.getcwd() + os.path.sep cmd = self._get_cmd(w, **vargs)
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) pipe = Popen(cmd, stdout=PIPE, stderr=PIPE)
linetokens = [] linetokens = []
@ -265,3 +271,11 @@ class CvsBlame(Method):
w.application.color_data_buffer("*Blame*", data, switch_to=True) w.application.color_data_buffer("*Blame*", data, switch_to=True)
else: else:
w.set_error("There was an error (%s)" % (status)) w.set_error("There was an error (%s)" % (status))
class CvsBlame2(CvsBlame):
'''show blame output for the current version in CVS'''
args = [arg("revision", t=type(""), p="Revision: ", h="revision number")]
line_re = re.compile('^([0-9.]+) +\(*([a-zA-Z0-9_]+) +([-0-9A-Za-z]+)\): (.*)$')
def _get_cmd(self, w, **vargs):
path = self._get_path(w, **vargs)
return ("/usr/bin/cvs", 'annotate', '-r', vargs['revision'], path)