Show More
@@ -938,7 +938,7 b' class localrepository(repo.repository):' | |||||
938 | for s in sorted(subs): |
|
938 | for s in sorted(subs): | |
939 | sub = wctx.sub(s) |
|
939 | sub = wctx.sub(s) | |
940 | self.ui.status(_('committing subrepository %s\n') % |
|
940 | self.ui.status(_('committing subrepository %s\n') % | |
941 | subrepo.relpath(sub)) |
|
941 | subrepo.subrelpath(sub)) | |
942 | sr = sub.commit(cctx._text, user, date) |
|
942 | sr = sub.commit(cctx._text, user, date) | |
943 | state[s] = (state[s][0], sr) |
|
943 | state[s] = (state[s][0], sr) | |
944 | subrepo.writestate(self, state) |
|
944 | subrepo.writestate(self, state) |
@@ -154,14 +154,18 b' def submerge(repo, wctx, mctx, actx):' | |||||
154 | # record merged .hgsubstate |
|
154 | # record merged .hgsubstate | |
155 | writestate(repo, sm) |
|
155 | writestate(repo, sm) | |
156 |
|
156 | |||
157 |
def relpath( |
|
157 | def reporelpath(repo): | |
|
158 | """return path to this (sub)repo as seen from outermost repo""" | |||
|
159 | parent = repo | |||
|
160 | while hasattr(parent, '_subparent'): | |||
|
161 | parent = parent._subparent | |||
|
162 | return repo.root[len(parent.root)+1:] | |||
|
163 | ||||
|
164 | def subrelpath(sub): | |||
158 | """return path to this subrepo as seen from outermost repo""" |
|
165 | """return path to this subrepo as seen from outermost repo""" | |
159 | if not hasattr(sub, '_repo'): |
|
166 | if not hasattr(sub, '_repo'): | |
160 | return sub._path |
|
167 | return sub._path | |
161 | parent = sub._repo |
|
168 | return reporelpath(sub._repo) | |
162 | while hasattr(parent, '_subparent'): |
|
|||
163 | parent = parent._subparent |
|
|||
164 | return sub._repo.root[len(parent.root)+1:] |
|
|||
165 |
|
169 | |||
166 | def _abssource(repo, push=False): |
|
170 | def _abssource(repo, push=False): | |
167 | """return pull/push path of repo - either based on parent repo |
|
171 | """return pull/push path of repo - either based on parent repo | |
@@ -332,7 +336,7 b' class hgsubrepo(abstractsubrepo):' | |||||
332 | return self._repo.status(ctx1, ctx2, **opts) |
|
336 | return self._repo.status(ctx1, ctx2, **opts) | |
333 | except error.RepoLookupError, inst: |
|
337 | except error.RepoLookupError, inst: | |
334 | self._repo.ui.warn(_('warning: error "%s" in subrepository "%s"\n') |
|
338 | self._repo.ui.warn(_('warning: error "%s" in subrepository "%s"\n') | |
335 | % (inst, relpath(self))) |
|
339 | % (inst, subrelpath(self))) | |
336 | return [], [], [], [], [], [], [] |
|
340 | return [], [], [], [], [], [], [] | |
337 |
|
341 | |||
338 | def diff(self, diffopts, node2, match, prefix, **opts): |
|
342 | def diff(self, diffopts, node2, match, prefix, **opts): | |
@@ -348,7 +352,7 b' class hgsubrepo(abstractsubrepo):' | |||||
348 | listsubrepos=True, **opts) |
|
352 | listsubrepos=True, **opts) | |
349 | except error.RepoLookupError, inst: |
|
353 | except error.RepoLookupError, inst: | |
350 | self._repo.ui.warn(_('warning: error "%s" in subrepository "%s"\n') |
|
354 | self._repo.ui.warn(_('warning: error "%s" in subrepository "%s"\n') | |
351 | % (inst, relpath(self))) |
|
355 | % (inst, subrelpath(self))) | |
352 |
|
356 | |||
353 | def archive(self, archiver, prefix): |
|
357 | def archive(self, archiver, prefix): | |
354 | abstractsubrepo.archive(self, archiver, prefix) |
|
358 | abstractsubrepo.archive(self, archiver, prefix) | |
@@ -372,7 +376,7 b' class hgsubrepo(abstractsubrepo):' | |||||
372 | return self._repo._checknested(self._repo.wjoin(path)) |
|
376 | return self._repo._checknested(self._repo.wjoin(path)) | |
373 |
|
377 | |||
374 | def commit(self, text, user, date): |
|
378 | def commit(self, text, user, date): | |
375 | self._repo.ui.debug("committing subrepo %s\n" % relpath(self)) |
|
379 | self._repo.ui.debug("committing subrepo %s\n" % subrelpath(self)) | |
376 | n = self._repo.commit(text, user, date) |
|
380 | n = self._repo.commit(text, user, date) | |
377 | if not n: |
|
381 | if not n: | |
378 | return self._repo['.'].hex() # different version checked out |
|
382 | return self._repo['.'].hex() # different version checked out | |
@@ -381,7 +385,7 b' class hgsubrepo(abstractsubrepo):' | |||||
381 | def remove(self): |
|
385 | def remove(self): | |
382 | # we can't fully delete the repository as it may contain |
|
386 | # we can't fully delete the repository as it may contain | |
383 | # local-only history |
|
387 | # local-only history | |
384 | self._repo.ui.note(_('removing subrepo %s\n') % relpath(self)) |
|
388 | self._repo.ui.note(_('removing subrepo %s\n') % subrelpath(self)) | |
385 | hg.clean(self._repo, node.nullid, False) |
|
389 | hg.clean(self._repo, node.nullid, False) | |
386 |
|
390 | |||
387 | def _get(self, state): |
|
391 | def _get(self, state): | |
@@ -392,7 +396,7 b' class hgsubrepo(abstractsubrepo):' | |||||
392 | self._repo._subsource = source |
|
396 | self._repo._subsource = source | |
393 | srcurl = _abssource(self._repo) |
|
397 | srcurl = _abssource(self._repo) | |
394 | self._repo.ui.status(_('pulling subrepo %s from %s\n') |
|
398 | self._repo.ui.status(_('pulling subrepo %s from %s\n') | |
395 | % (relpath(self), srcurl)) |
|
399 | % (subrelpath(self), srcurl)) | |
396 | other = hg.repository(self._repo.ui, srcurl) |
|
400 | other = hg.repository(self._repo.ui, srcurl) | |
397 | self._repo.pull(other) |
|
401 | self._repo.pull(other) | |
398 |
|
402 | |||
@@ -408,12 +412,12 b' class hgsubrepo(abstractsubrepo):' | |||||
408 | dst = self._repo[state[1]] |
|
412 | dst = self._repo[state[1]] | |
409 | anc = dst.ancestor(cur) |
|
413 | anc = dst.ancestor(cur) | |
410 | if anc == cur: |
|
414 | if anc == cur: | |
411 | self._repo.ui.debug("updating subrepo %s\n" % relpath(self)) |
|
415 | self._repo.ui.debug("updating subrepo %s\n" % subrelpath(self)) | |
412 | hg.update(self._repo, state[1]) |
|
416 | hg.update(self._repo, state[1]) | |
413 | elif anc == dst: |
|
417 | elif anc == dst: | |
414 | self._repo.ui.debug("skipping subrepo %s\n" % relpath(self)) |
|
418 | self._repo.ui.debug("skipping subrepo %s\n" % subrelpath(self)) | |
415 | else: |
|
419 | else: | |
416 | self._repo.ui.debug("merging subrepo %s\n" % relpath(self)) |
|
420 | self._repo.ui.debug("merging subrepo %s\n" % subrelpath(self)) | |
417 | hg.merge(self._repo, state[1], remind=False) |
|
421 | hg.merge(self._repo, state[1], remind=False) | |
418 |
|
422 | |||
419 | def push(self, force): |
|
423 | def push(self, force): | |
@@ -426,7 +430,7 b' class hgsubrepo(abstractsubrepo):' | |||||
426 |
|
430 | |||
427 | dsturl = _abssource(self._repo, True) |
|
431 | dsturl = _abssource(self._repo, True) | |
428 | self._repo.ui.status(_('pushing subrepo %s to %s\n') % |
|
432 | self._repo.ui.status(_('pushing subrepo %s to %s\n') % | |
429 | (relpath(self), dsturl)) |
|
433 | (subrelpath(self), dsturl)) | |
430 | other = hg.repository(self._repo.ui, dsturl) |
|
434 | other = hg.repository(self._repo.ui, dsturl) | |
431 | return self._repo.push(other, force) |
|
435 | return self._repo.push(other, force) | |
432 |
|
436 |
General Comments 0
You need to be logged in to leave comments.
Login now