##// END OF EJS Templates
subrepo: allow a representation of the working directory subrepo...
Matt Harbison -
r25600:70ac1868 default
parent child Browse files
Show More
@@ -249,11 +249,18 b' class basectx(object):'
249 return ''
249 return ''
250
250
251 def sub(self, path):
251 def sub(self, path):
252 '''return a subrepo for the stored revision of path, never wdir()'''
252 return subrepo.subrepo(self, path)
253 return subrepo.subrepo(self, path)
253
254
254 def nullsub(self, path, pctx):
255 def nullsub(self, path, pctx):
255 return subrepo.nullsubrepo(self, path, pctx)
256 return subrepo.nullsubrepo(self, path, pctx)
256
257
258 def workingsub(self, path):
259 '''return a subrepo for the stored revision, or wdir if this is a wdir
260 context.
261 '''
262 return subrepo.subrepo(self, path, allowwdir=True)
263
257 def match(self, pats=[], include=None, exclude=None, default='glob',
264 def match(self, pats=[], include=None, exclude=None, default='glob',
258 listsubrepos=False, badfn=None):
265 listsubrepos=False, badfn=None):
259 r = self._repo
266 r = self._repo
@@ -324,7 +324,7 b' def _sanitize(ui, vfs, ignore):'
324 "in '%s'\n") % vfs.join(dirname))
324 "in '%s'\n") % vfs.join(dirname))
325 vfs.unlink(vfs.reljoin(dirname, f))
325 vfs.unlink(vfs.reljoin(dirname, f))
326
326
327 def subrepo(ctx, path):
327 def subrepo(ctx, path, allowwdir=False):
328 """return instance of the right subrepo class for subrepo in path"""
328 """return instance of the right subrepo class for subrepo in path"""
329 # subrepo inherently violates our import layering rules
329 # subrepo inherently violates our import layering rules
330 # because it wants to make repo objects from deep inside the stack
330 # because it wants to make repo objects from deep inside the stack
@@ -338,6 +338,8 b' def subrepo(ctx, path):'
338 state = ctx.substate[path]
338 state = ctx.substate[path]
339 if state[2] not in types:
339 if state[2] not in types:
340 raise util.Abort(_('unknown subrepo type %s') % state[2])
340 raise util.Abort(_('unknown subrepo type %s') % state[2])
341 if allowwdir:
342 state = (state[0], ctx.subrev(path), state[2])
341 return types[state[2]](ctx, path, state[:2])
343 return types[state[2]](ctx, path, state[:2])
342
344
343 def nullsubrepo(ctx, path, pctx):
345 def nullsubrepo(ctx, path, pctx):
General Comments 0
You need to be logged in to leave comments. Login now