comparison mercurial/subrepo.py @ 10027:30d51a0df46c

subrepo: document necessary methods for a subrepo class
author Augie Fackler <durin42@gmail.com>
date Wed, 09 Dec 2009 14:33:22 -0600
parents ee00ef6f9be7
children 606b563e41db
comparison
equal deleted inserted replaced
10026:0b0a46607ac9 10027:30d51a0df46c
147 state = ctx.substate.get(path, nullstate) 147 state = ctx.substate.get(path, nullstate)
148 if state[0].startswith('['): # future expansion 148 if state[0].startswith('['): # future expansion
149 raise error.Abort('unknown subrepo source %s' % state[0]) 149 raise error.Abort('unknown subrepo source %s' % state[0])
150 return hgsubrepo(ctx, path, state) 150 return hgsubrepo(ctx, path, state)
151 151
152 # subrepo classes need to implement the following methods:
153 # __init__(self, ctx, path, state)
154 # dirty(self): returns true if the dirstate of the subrepo
155 # does not match current stored state
156 # commit(self, text, user, date): commit the current changes
157 # to the subrepo with the given log message. Use given
158 # user and date if possible. Return the new state of the subrepo.
159 # remove(self): remove the subrepo (should verify the dirstate
160 # is not dirty first)
161 # get(self, state): run whatever commands are needed to put the
162 # subrepo into this state
163 # merge(self, state): merge currently-saved state with the new state.
164 # push(self, force): perform whatever action is analagous to 'hg push'
165 # This may be a no-op on some systems.
166
152 class hgsubrepo(object): 167 class hgsubrepo(object):
153 def __init__(self, ctx, path, state): 168 def __init__(self, ctx, path, state):
154 self._path = path 169 self._path = path
155 self._state = state 170 self._state = state
156 r = ctx._repo 171 r = ctx._repo