mercurial/repo.py
changeset 7637 1d54e2f6c0b7
parent 6526 cfeeac24fc1e
child 7873 4a4c7f6a5912
equal deleted inserted replaced
7636:e3f8c6d6b72e 7637:1d54e2f6c0b7
     5 #
     5 #
     6 # This software may be used and distributed according to the terms
     6 # This software may be used and distributed according to the terms
     7 # of the GNU General Public License, incorporated herein by reference.
     7 # of the GNU General Public License, incorporated herein by reference.
     8 
     8 
     9 from i18n import _
     9 from i18n import _
    10 
       
    11 class RepoError(Exception):
       
    12     pass
       
    13 
       
    14 class NoCapability(RepoError):
       
    15     pass
       
    16 
    10 
    17 class repository(object):
    11 class repository(object):
    18     def capable(self, name):
    12     def capable(self, name):
    19         '''tell whether repo supports named capability.
    13         '''tell whether repo supports named capability.
    20         return False if not supported.
    14         return False if not supported.
    29         return False
    23         return False
    30 
    24 
    31     def requirecap(self, name, purpose):
    25     def requirecap(self, name, purpose):
    32         '''raise an exception if the given capability is not present'''
    26         '''raise an exception if the given capability is not present'''
    33         if not self.capable(name):
    27         if not self.capable(name):
    34             raise NoCapability(_('cannot %s; remote repository does not '
    28             raise error.CapabilityError(
    35                                  'support the %r capability') %
    29                 _('cannot %s; remote repository does not '
    36                                (purpose, name))
    30                   'support the %r capability') % (purpose, name))
    37 
    31 
    38     def local(self):
    32     def local(self):
    39         return False
    33         return False
    40 
    34 
    41     def cancopy(self):
    35     def cancopy(self):