parent
6846b0dc3b
commit
6a5220d838
|
@ -1176,7 +1176,6 @@ class SvnStatus(Method):
|
||||||
raise Exception, '%r %r' % (fields, data[6:])
|
raise Exception, '%r %r' % (fields, data[6:])
|
||||||
|
|
||||||
w.set_error('%s %s %s/%s [%s]' % (filename, status, rrev, lrev, lauthor))
|
w.set_error('%s %s %s/%s [%s]' % (filename, status, rrev, lrev, lauthor))
|
||||||
|
|
||||||
class SvnDiff(Method):
|
class SvnDiff(Method):
|
||||||
'''diff the current file with the version in SVN'''
|
'''diff the current file with the version in SVN'''
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
|
@ -1195,6 +1194,68 @@ class SvnDiff(Method):
|
||||||
w.set_error("No difference found")
|
w.set_error("No difference found")
|
||||||
else:
|
else:
|
||||||
w.set_error("There was an error (%s)" % (status))
|
w.set_error("There was an error (%s)" % (status))
|
||||||
|
class SvnDiff2(Method):
|
||||||
|
'''diff the current file with the version in SVN'''
|
||||||
|
rev_regex = re.compile('^[0-9]+$')
|
||||||
|
args = [Argument("revision", type=type(""), prompt="Old Revision: ")]
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
if not hasattr(w.buffer, 'path'):
|
||||||
|
w.set_error("Buffer has no corresponding file")
|
||||||
|
return
|
||||||
|
|
||||||
|
rev = vargs['revision']
|
||||||
|
if not self.rev_regex.match(rev):
|
||||||
|
w.set_error("Could not parse revision: %r" % rev)
|
||||||
|
return
|
||||||
|
|
||||||
|
cwd = os.getcwd() + os.path.sep
|
||||||
|
path = w.buffer.path
|
||||||
|
if path.startswith(cwd):
|
||||||
|
path = path[len(cwd):]
|
||||||
|
|
||||||
|
cmd = "svn diff -r %s %r" % (rev, path)
|
||||||
|
(status, data) = commands.getstatusoutput(cmd)
|
||||||
|
status = status >> 8
|
||||||
|
|
||||||
|
if data:
|
||||||
|
w.application.data_buffer("*Diff*", data, switch_to=True, modename='diff')
|
||||||
|
w.set_error("Differences were found")
|
||||||
|
else:
|
||||||
|
w.set_error("No difference found")
|
||||||
|
class SvnDiff3(Method):
|
||||||
|
'''diff the current file with the version in SVN'''
|
||||||
|
rev_regex = re.compile('^[0-9]+$')
|
||||||
|
args = [Argument("revision1", type=type(""), prompt="Old Revision: "),
|
||||||
|
Argument("revision2", type=type(""), prompt="New Revision: ")]
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
if not hasattr(w.buffer, 'path'):
|
||||||
|
w.set_error("Buffer has no corresponding file")
|
||||||
|
return
|
||||||
|
|
||||||
|
rev1 = vargs['revision1']
|
||||||
|
if not self.rev_regex.match(rev1):
|
||||||
|
w.set_error("Could not parse revision1: %r" % rev)
|
||||||
|
return
|
||||||
|
|
||||||
|
rev2 = vargs['revision2']
|
||||||
|
if not self.rev_regex.match(rev2):
|
||||||
|
w.set_error("Could not parse revision2: %r" % rev)
|
||||||
|
return
|
||||||
|
|
||||||
|
cwd = os.getcwd() + os.path.sep
|
||||||
|
path = w.buffer.path
|
||||||
|
if path.startswith(cwd):
|
||||||
|
path = path[len(cwd):]
|
||||||
|
|
||||||
|
cmd = "svn diff -r %s -r %s %r" % (rev1, rev2, path)
|
||||||
|
(status, data) = commands.getstatusoutput(cmd)
|
||||||
|
status = status >> 8
|
||||||
|
|
||||||
|
if data:
|
||||||
|
w.application.data_buffer("*Diff*", data, switch_to=True, modename='diff')
|
||||||
|
w.set_error("Differences were found")
|
||||||
|
else:
|
||||||
|
w.set_error("No difference found")
|
||||||
class SvnBlame(Method):
|
class SvnBlame(Method):
|
||||||
'''show blame output for the current version in SVN'''
|
'''show blame output for the current version in SVN'''
|
||||||
line_re = re.compile('^ *(\d+) *([a-zA-Z0-9_]+) *([-0-9]+) *([:0-9]+) *(-\d{4}) *\(([^\)]+)\) (.*)$')
|
line_re = re.compile('^ *(\d+) *([a-zA-Z0-9_]+) *([-0-9]+) *([:0-9]+) *(-\d{4}) *\(([^\)]+)\) (.*)$')
|
||||||
|
|
Loading…
Reference in New Issue