1a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)# Copyright 2013 The Chromium Authors. All rights reserved.
2a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)# Use of this source code is governed by a BSD-style license that can be
3a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)# found in the LICENSE file.
4a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)
5a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)class Patcher(object):
6a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)  def GetPatchedFiles(self, version=None):
7ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch    '''Returns patched files as(added_files, deleted_files, modified_files)
8a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)    from the patchset specified by |version|.
9a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)    '''
10ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch    raise NotImplementedError(self.__class__)
11a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)
12a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)  def GetVersion(self):
13ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch    '''Returns patch version. Returns None when nothing is patched by the
14a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)    patcher.
15a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)    '''
16ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch    raise NotImplementedError(self.__class__)
17a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)
18a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  def Apply(self, paths, file_system, version=None):
19ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch    '''Apply the patch to added/modified files. Returns Future with patched
20a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)    data. Throws FileNotFoundError if |paths| contains deleted files.
21a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)    '''
22ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch    raise NotImplementedError(self.__class__)
23ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch
24ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  def GetIdentity(self):
25ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch    '''Returns a string that identifies this patch. Typically it would be the
26ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch    codereview server's ID for this patch.
27ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch    '''
28ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch    raise NotImplementedError(self.__class__)
29