##// END OF EJS Templates
subrepo: expand relative sources for git subrepos
Eric Eisner -
r13460:64bb8e58 stable
parent child Browse files
Show More
@@ -659,6 +659,7 b' class gitsubrepo(abstractsubrepo):'
659 self._path = path
659 self._path = path
660 self._relpath = os.path.join(reporelpath(ctx._repo), path)
660 self._relpath = os.path.join(reporelpath(ctx._repo), path)
661 self._abspath = ctx._repo.wjoin(path)
661 self._abspath = ctx._repo.wjoin(path)
662 self._subparent = ctx._repo
662 self._ui = ctx._repo.ui
663 self._ui = ctx._repo.ui
663
664
664 def _gitcommand(self, commands, env=None, stream=False):
665 def _gitcommand(self, commands, env=None, stream=False):
@@ -751,10 +752,14 b' class gitsubrepo(abstractsubrepo):'
751 (remote, ref.split('/', 2)[2])] = b
752 (remote, ref.split('/', 2)[2])] = b
752 return tracking
753 return tracking
753
754
755 def _abssource(self, source):
756 self._subsource = source
757 return _abssource(self)
758
754 def _fetch(self, source, revision):
759 def _fetch(self, source, revision):
755 if not os.path.exists(os.path.join(self._abspath, '.git')):
760 if not os.path.exists(os.path.join(self._abspath, '.git')):
756 self._ui.status(_('cloning subrepo %s\n') % self._relpath)
761 self._ui.status(_('cloning subrepo %s\n') % self._relpath)
757 self._gitnodir(['clone', source, self._abspath])
762 self._gitnodir(['clone', self._abssource(source), self._abspath])
758 if self._githavelocally(revision):
763 if self._githavelocally(revision):
759 return
764 return
760 self._ui.status(_('pulling subrepo %s\n') % self._relpath)
765 self._ui.status(_('pulling subrepo %s\n') % self._relpath)
@@ -763,7 +768,7 b' class gitsubrepo(abstractsubrepo):'
763 if self._githavelocally(revision):
768 if self._githavelocally(revision):
764 return
769 return
765 # then try from known subrepo source
770 # then try from known subrepo source
766 self._gitcommand(['fetch', source])
771 self._gitcommand(['fetch', self._abssource(source)])
767 if not self._githavelocally(revision):
772 if not self._githavelocally(revision):
768 raise util.Abort(_("revision %s does not exist in subrepo %s\n") %
773 raise util.Abort(_("revision %s does not exist in subrepo %s\n") %
769 (revision, self._relpath))
774 (revision, self._relpath))
@@ -305,6 +305,15 b' nested archive'
305 f
305 f
306 g
306 g
307
307
308 relative source expansion
309
310 $ cd ..
311 $ mkdir d
312 $ hg clone t d/t
313 updating to branch default
314 cloning subrepo s
315 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
316
308 Check hg update --clean
317 Check hg update --clean
309 $ cd $TESTTMP/ta
318 $ cd $TESTTMP/ta
310 $ echo > s/g
319 $ echo > s/g
General Comments 0
You need to be logged in to leave comments. Login now