new methods: cvs-rev-view and cvs-date-view
--HG-- branch : pmacs2
This commit is contained in:
parent
fce419293c
commit
7c0fc7b783
|
@ -279,3 +279,44 @@ class CvsBlame2(CvsBlame):
|
|||
def _get_cmd(self, w, **vargs):
|
||||
path = self._get_path(w, **vargs)
|
||||
return ("/usr/bin/cvs", 'annotate', '-r', vargs['revision'], path)
|
||||
|
||||
class CvsRevView(Method):
|
||||
'''show blame output for the current version in CVS'''
|
||||
args = [arg("revision", t=type(""), p="Revision: ", h="revision number")]
|
||||
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", 'up', '-p', '-r', vargs['revision'], path)
|
||||
|
||||
def _get_name(self, w, **vargs):
|
||||
return '*CVS:%s-%s' % (w.buffer.name(), vargs['revision'])
|
||||
|
||||
def _execute(self, w, **vargs):
|
||||
if not hasattr(w.buffer, 'path'):
|
||||
w.set_error("Buffer has no corresponding file")
|
||||
return
|
||||
|
||||
cmd = self._get_cmd(w, **vargs)
|
||||
pipe = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||
name = self._get_name(w, **vargs)
|
||||
data = pipe.stdout.read()
|
||||
status = pipe.wait() >> 8
|
||||
mname = w.mode.name.lower()
|
||||
|
||||
w.application.data_buffer(name, data, switch_to=True, modename=mname)
|
||||
|
||||
class CvsDateView(CvsRevView):
|
||||
'''show blame output for the current version in CVS'''
|
||||
args = [arg("date", t=type(""), p="Date: ", h="date specifier")]
|
||||
def _get_cmd(self, w, **vargs):
|
||||
path = self._get_path(w, **vargs)
|
||||
return ("/usr/bin/cvs", 'up', '-p', '-D', vargs['date'], path)
|
||||
|
||||
def _get_name(self, w, **vargs):
|
||||
return '*CVS:%s-%s' % (w.buffer.name(), vargs['date'])
|
||||
|
|
Loading…
Reference in New Issue