Show More
@@ -1,49 +1,46 b'' | |||
|
1 | 1 | # peer.py - repository base classes for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> |
|
5 | 5 | # |
|
6 | 6 | # This software may be used and distributed according to the terms of the |
|
7 | 7 | # GNU General Public License version 2 or any later version. |
|
8 | 8 | |
|
9 | 9 | from i18n import _ |
|
10 | 10 | import error |
|
11 | 11 | |
|
12 | 12 | class peerrepository(object): |
|
13 | 13 | |
|
14 | 14 | def capable(self, name): |
|
15 | 15 | '''tell whether repo supports named capability. |
|
16 | 16 | return False if not supported. |
|
17 | 17 | if boolean capability, return True. |
|
18 | 18 | if string capability, return string.''' |
|
19 | 19 | caps = self._capabilities() |
|
20 | 20 | if name in caps: |
|
21 | 21 | return True |
|
22 | 22 | name_eq = name + '=' |
|
23 | 23 | for cap in caps: |
|
24 | 24 | if cap.startswith(name_eq): |
|
25 | 25 | return cap[len(name_eq):] |
|
26 | 26 | return False |
|
27 | 27 | |
|
28 | 28 | def requirecap(self, name, purpose): |
|
29 | 29 | '''raise an exception if the given capability is not present''' |
|
30 | 30 | if not self.capable(name): |
|
31 | 31 | raise error.CapabilityError( |
|
32 | 32 | _('cannot %s; remote repository does not ' |
|
33 | 33 | 'support the %r capability') % (purpose, name)) |
|
34 | 34 | |
|
35 | 35 | def local(self): |
|
36 | 36 | '''return peer as a localrepo, or None''' |
|
37 | 37 | return None |
|
38 | 38 | |
|
39 | 39 | def peer(self): |
|
40 | 40 | return self |
|
41 | 41 | |
|
42 | def peer(self): | |
|
43 | return self | |
|
44 | ||
|
45 | 42 | def canpush(self): |
|
46 | 43 | return True |
|
47 | 44 | |
|
48 | 45 | def close(self): |
|
49 | 46 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now