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