3
class PatchSource(object):
10
def can_live_update(self):
14
raise NotImplementedError()
17
return patches.parse_patches(self.readlines())
19
class FilePatchSource(PatchSource):
20
def __init__(self, filename):
21
self.filename = filename
22
PatchSource.__init__(self)
25
f = open(self.filename, 'r')
28
class BzrPatchSource(PatchSource):
29
def __init__(self, revision=None, file_list=None):
30
from bzrlib.branch import Branch
31
self.revision = revision
32
self.file_list = file_list
33
if file_list is not None and len(file_list) > 0:
34
location = file_list[0]
37
self.branch = Branch.open_containing(location)[0]
39
PatchSource.__init__(self)
41
def can_live_update(self):
45
from StringIO import StringIO
46
from bzrlib.diff import show_diff
48
show_diff(self.branch, self.revision,
49
specific_files=self.file_list, output=f)