parent
9093d0d691
commit
f69ec62f08
|
@ -22,9 +22,7 @@ class CvsCommit(Method):
|
|||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs ci -m %r %r" % (vargs['msg'], path)
|
||||
(status, data) = commands.getstatusoutput(cmd)
|
||||
status = status >> 8
|
||||
lines = data.split('\n')
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
if status == 0:
|
||||
for line in lines:
|
||||
|
@ -55,14 +53,13 @@ class CvsStatus(Method):
|
|||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs status %r" % path
|
||||
(status, data) = commands.getstatusoutput(cmd)
|
||||
status = status >> 8
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
if status != 0:
|
||||
w.set_error("Problems with CVS status: %d" % status)
|
||||
return
|
||||
|
||||
lines = data.split('\n')
|
||||
lines = out.split('\n')
|
||||
|
||||
if lines[0].startswith('cvs status: nothing known about '):
|
||||
w.set_error('File is not under CVS control')
|
||||
|
@ -118,9 +115,8 @@ class CvsLog(Method):
|
|||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs log %r" % path
|
||||
(status, data) = commands.getstatusoutput(cmd)
|
||||
status = status >> 8
|
||||
w.application.data_buffer("*Log*", data, switch_to=True)
|
||||
status, out, err = util.communicate(cmd)
|
||||
w.application.data_buffer("*Log*", out, switch_to=True)
|
||||
w.set_error("cvs log exited with %d" % status)
|
||||
|
||||
class CvsDiff(Method):
|
||||
|
@ -136,13 +132,12 @@ class CvsDiff(Method):
|
|||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs diff -u %r" % path
|
||||
(status, data) = commands.getstatusoutput(cmd)
|
||||
status = status >> 8
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
if status == 0:
|
||||
w.set_error("No difference found")
|
||||
else:
|
||||
w.application.data_buffer("*Diff*", data, switch_to=True, modename='diff')
|
||||
w.application.data_buffer("*Diff*", out, switch_to=True, modename='diff')
|
||||
w.set_error("Differences were found")
|
||||
class CvsDiff2(Method):
|
||||
'''diff the current file's contents with a version in CVS'''
|
||||
|
@ -165,13 +160,12 @@ class CvsDiff2(Method):
|
|||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs diff -r %s -u %r" % (rev, path)
|
||||
(status, data) = commands.getstatusoutput(cmd)
|
||||
status = status >> 8
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
if status == 0:
|
||||
w.set_error("No difference found")
|
||||
else:
|
||||
w.application.data_buffer("*Diff*", data, switch_to=True, modename='diff')
|
||||
w.application.data_buffer("*Diff*", out, switch_to=True, modename='diff')
|
||||
w.set_error("Differences were found")
|
||||
class CvsDiff3(Method):
|
||||
'''diff the current file with the version in CVS'''
|
||||
|
@ -199,13 +193,12 @@ class CvsDiff3(Method):
|
|||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs diff -r %s -r %s -u %r" % (rev1, rev2, path)
|
||||
(status, data) = commands.getstatusoutput(cmd)
|
||||
status = status >> 8
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
if status == 0:
|
||||
w.set_error("No difference found")
|
||||
else:
|
||||
w.application.data_buffer("*Diff*", data, switch_to=True, modename='diff')
|
||||
w.application.data_buffer("*Diff*", out, switch_to=True, modename='diff')
|
||||
w.set_error("Differences were found")
|
||||
|
||||
class CvsBlame(Method):
|
||||
|
@ -228,20 +221,21 @@ class CvsBlame(Method):
|
|||
return
|
||||
|
||||
cmd = self._get_cmd(w, **vargs)
|
||||
pipe = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||
status, out, err = util.communicate(cmd, stderr=True, shell=False)
|
||||
|
||||
linetokens = []
|
||||
max_rev = 0
|
||||
max_user = 0
|
||||
for line in pipe.stdout:
|
||||
for line in out.split('\n'):
|
||||
if not line:
|
||||
continue
|
||||
m = self.line_re.match(line)
|
||||
if not m:
|
||||
raise Exception, line
|
||||
raise Exception(repr(line))
|
||||
(rev, user, date, content) = m.groups()
|
||||
max_rev = max(max_rev, len(rev))
|
||||
max_user = max(max_user, len(user))
|
||||
linetokens.append([rev, user, date, content, []])
|
||||
status = pipe.wait() >> 8
|
||||
|
||||
lines = [x[3] for x in linetokens]
|
||||
if w.mode.grammar:
|
||||
|
@ -266,7 +260,6 @@ class CvsBlame(Method):
|
|||
lines.append('%s %s' % (prefix, suffix))
|
||||
data = ''.join(lines)
|
||||
|
||||
status = pipe.wait() >> 8
|
||||
if status == 0:
|
||||
w.application.color_data_buffer("*Blame*", data, switch_to=True)
|
||||
else:
|
||||
|
@ -302,14 +295,12 @@ class CvsRevView(Method):
|
|||
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()
|
||||
cmd = self._get_cmd(w, **vargs)
|
||||
name = self._get_name(w, **vargs)
|
||||
mname = w.mode.name.lower()
|
||||
status, out, err = util.communicate(cmd, stderr=True, shell=False)
|
||||
|
||||
w.application.data_buffer(name, data, switch_to=True, modename=mname)
|
||||
w.application.data_buffer(name, out, switch_to=True, modename=mname)
|
||||
|
||||
class CvsDateView(CvsRevView):
|
||||
'''show blame output for the current version in CVS'''
|
||||
|
|
Loading…
Reference in New Issue