##// END OF EJS Templates
subrepo: add abstract superclass for subrepo classes
Martin Geisler -
r11559:9d885974 default
parent child Browse files
Show More
@@ -172,22 +172,49 b' def subrepo(ctx, path):'
172 172 raise util.Abort(_('unknown subrepo type %s') % state[2])
173 173 return types[state[2]](ctx, path, state[:2])
174 174
175 # subrepo classes need to implement the following methods:
176 # __init__(self, ctx, path, state)
177 # dirty(self): returns true if the dirstate of the subrepo
178 # does not match current stored state
179 # commit(self, text, user, date): commit the current changes
180 # to the subrepo with the given log message. Use given
181 # user and date if possible. Return the new state of the subrepo.
182 # remove(self): remove the subrepo (should verify the dirstate
183 # is not dirty first)
184 # get(self, state): run whatever commands are needed to put the
185 # subrepo into this state
186 # merge(self, state): merge currently-saved state with the new state.
187 # push(self, force): perform whatever action is analagous to 'hg push'
188 # This may be a no-op on some systems.
175 # subrepo classes need to implement the following abstract class:
176
177 class abstractsubrepo(object):
178
179 def dirty(self):
180 """returns true if the dirstate of the subrepo does not match
181 current stored state
182 """
183 raise NotImplementedError
184
185 def commit(self, text, user, date):
186 """commit the current changes to the subrepo with the given
187 log message. Use given user and date if possible. Return the
188 new state of the subrepo.
189 """
190 raise NotImplementedError
191
192 def remove(self):
193 """remove the subrepo
189 194
190 class hgsubrepo(object):
195 (should verify the dirstate is not dirty first)
196 """
197 raise NotImplementedError
198
199 def get(self, state):
200 """run whatever commands are needed to put the subrepo into
201 this state
202 """
203 raise NotImplementedError
204
205 def merge(self, state):
206 """merge currently-saved state with the new state."""
207 raise NotImplementedError
208
209 def push(self, force):
210 """perform whatever action is analagous to 'hg push'
211
212 This may be a no-op on some systems.
213 """
214 raise NotImplementedError
215
216
217 class hgsubrepo(abstractsubrepo):
191 218 def __init__(self, ctx, path, state):
192 219 self._path = path
193 220 self._state = state
@@ -284,7 +311,7 b' class hgsubrepo(object):'
284 311 other = hg.repository(self._repo.ui, dsturl)
285 312 return self._repo.push(other, force)
286 313
287 class svnsubrepo(object):
314 class svnsubrepo(abstractsubrepo):
288 315 def __init__(self, ctx, path, state):
289 316 self._path = path
290 317 self._state = state
General Comments 0
You need to be logged in to leave comments. Login now