93 self = args[0] |
92 self = args[0] |
94 encresref.set(self._submitone(f.func_name, encargsorres)) |
93 encresref.set(self._submitone(f.func_name, encargsorres)) |
95 return next(batchable) |
94 return next(batchable) |
96 setattr(plain, 'batchable', f) |
95 setattr(plain, 'batchable', f) |
97 return plain |
96 return plain |
98 |
|
99 class peerrepository(object): |
|
100 def iterbatch(self): |
|
101 """Batch requests but allow iterating over the results. |
|
102 |
|
103 This is to allow interleaving responses with things like |
|
104 progress updates for clients. |
|
105 """ |
|
106 return localiterbatcher(self) |
|
107 |
|
108 def capable(self, name): |
|
109 '''tell whether repo supports named capability. |
|
110 return False if not supported. |
|
111 if boolean capability, return True. |
|
112 if string capability, return string.''' |
|
113 caps = self._capabilities() |
|
114 if name in caps: |
|
115 return True |
|
116 name_eq = name + '=' |
|
117 for cap in caps: |
|
118 if cap.startswith(name_eq): |
|
119 return cap[len(name_eq):] |
|
120 return False |
|
121 |
|
122 def requirecap(self, name, purpose): |
|
123 '''raise an exception if the given capability is not present''' |
|
124 if not self.capable(name): |
|
125 raise error.CapabilityError( |
|
126 _('cannot %s; remote repository does not ' |
|
127 'support the %r capability') % (purpose, name)) |
|
128 |
|
129 def local(self): |
|
130 '''return peer as a localrepo, or None''' |
|
131 return None |
|
132 |
|
133 def peer(self): |
|
134 return self |
|
135 |
|
136 def canpush(self): |
|
137 return True |
|
138 |
|
139 def close(self): |
|
140 pass |
|