fix some bugs in cvs-commit and improve util.communicate()
--HG-- branch : pmacs2
This commit is contained in:
parent
6d3eab1a47
commit
5a72e293c7
|
@ -16,24 +16,26 @@ class CvsCommit(Method):
|
|||
w.set_error("Buffer has no corresponding file")
|
||||
return
|
||||
|
||||
cwd = os.getcwd() + os.path.sep
|
||||
cwd = os.getcwd() + os.path.sep
|
||||
path = w.buffer.path
|
||||
if path.startswith(cwd):
|
||||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs ci -m %r %r" % (vargs['msg'], path)
|
||||
cmd = ["cvs", "ci", "-m", vargs['msg'], path]
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
if status == 0:
|
||||
for line in out.split('\n'):
|
||||
m = self.regex.match(line)
|
||||
if m:
|
||||
w.set_error("Committed [%s -> %s]" % (m.group(2), m.group(1)))
|
||||
return
|
||||
w.set_error("Up-to-date")
|
||||
else:
|
||||
if status != 0:
|
||||
w.set_error("Problems with CVS commit: %d" % status)
|
||||
w.application.data_buffer("*Commit*", data, switch_to=True)
|
||||
w.application.data_buffer("*Commit*", err, switch_to=True)
|
||||
return
|
||||
|
||||
for line in out.split('\n'):
|
||||
m = self.regex.match(line)
|
||||
if not m:
|
||||
continue
|
||||
w.set_error("Committed [%s -> %s]" % (m.group(2), m.group(1)))
|
||||
return
|
||||
w.set_error("Up-to-date")
|
||||
|
||||
class CvsStatus(Method):
|
||||
regex1 = re.compile('^File: (.+?) *\tStatus: (.*?)$')
|
||||
|
@ -52,7 +54,8 @@ class CvsStatus(Method):
|
|||
if path.startswith(cwd):
|
||||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs status %r" % path
|
||||
#cmd = "cvs status %r" % path
|
||||
cmd = ['cvs', 'status', path]
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
if status != 0:
|
||||
|
@ -114,7 +117,8 @@ class CvsLog(Method):
|
|||
if path.startswith(cwd):
|
||||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs log %r" % path
|
||||
#cmd = "cvs log %r" % path
|
||||
cmd = ['cvs', 'log', path]
|
||||
status, out, err = util.communicate(cmd)
|
||||
w.application.data_buffer("*Log*", out, switch_to=True)
|
||||
w.set_error("cvs log exited with %d" % status)
|
||||
|
@ -131,7 +135,8 @@ class CvsDiff(Method):
|
|||
if path.startswith(cwd):
|
||||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs diff -u %r" % path
|
||||
#cmd = "cvs diff -u %r" % path
|
||||
cmd = ['cvs', 'diff', '-u', path]
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
if status == 0:
|
||||
|
@ -159,7 +164,8 @@ class CvsDiff2(Method):
|
|||
if path.startswith(cwd):
|
||||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs diff -r %s -u %r" % (rev, path)
|
||||
#cmd = "cvs diff -r %s -u %r" % (rev, path)
|
||||
cmd = ["cvs", "diff", "-r", rev, "-u", path]
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
if status == 0:
|
||||
|
@ -192,7 +198,8 @@ class CvsDiff3(Method):
|
|||
if path.startswith(cwd):
|
||||
path = path[len(cwd):]
|
||||
|
||||
cmd = "cvs diff -r %s -r %s -u %r" % (rev1, rev2, path)
|
||||
#cmd = "cvs diff -r %s -r %s -u %r" % (rev1, rev2, path)
|
||||
cmd = ["cvs", "diff", "-r", rev1, "-r", rev2, "-u", path]
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
if status == 0:
|
||||
|
@ -221,7 +228,7 @@ class CvsBlame(Method):
|
|||
return
|
||||
|
||||
cmd = self._get_cmd(w, **vargs)
|
||||
status, out, err = util.communicate(cmd, stderr=True, shell=False)
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
linetokens = []
|
||||
max_rev = 0
|
||||
|
@ -298,7 +305,7 @@ class CvsRevView(Method):
|
|||
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)
|
||||
status, out, err = util.communicate(cmd)
|
||||
|
||||
w.application.data_buffer(name, out, switch_to=True, modename=mname)
|
||||
|
||||
|
|
Loading…
Reference in New Issue