[PATCH] subrepo: expand relative sources for git subrepos

Matt Mackall mpm at selenic.com
Wed Feb 23 03:25:01 UTC 2011


On Tue, 2011-02-22 at 15:44 -0500, Eric Eisner wrote:
> On Tue, Feb 22, 2011 at 15:12, Eric Eisner <ede at mit.edu> wrote:
> 
> > # HG changeset patch
> > # User Eric Eisner <ede at mit.edu>
> > # Date 1298405470 18000
> > # Branch stable
> > # Node ID 64bb8e586a92a5e5f2f5edf5843ac3ffc85f4495
> > # Parent  acbe171c8fbe9b789057f84fb962a9c2a966a787
> > subrepo: expand relative sources for git subrepos
> >
> > diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
> > --- a/mercurial/subrepo.py
> > +++ b/mercurial/subrepo.py
> > @@ -659,6 +659,7 @@ class gitsubrepo(abstractsubrepo):
> >         self._path = path
> >         self._relpath = os.path.join(reporelpath(ctx._repo), path)
> >         self._abspath = ctx._repo.wjoin(path)
> > +        self._subparent = ctx._repo
> >         self._ui = ctx._repo.ui
> >
> >     def _gitcommand(self, commands, env=None, stream=False):
> > @@ -751,10 +752,14 @@ class gitsubrepo(abstractsubrepo):
> >                          (remote, ref.split('/', 2)[2])] = b
> >         return tracking
> >
> > +    def _abssource(self, source):
> > +        self._subsource = source
> > +        return _abssource(self)
> > +
> >     def _fetch(self, source, revision):
> >         if not os.path.exists(os.path.join(self._abspath, '.git')):
> >             self._ui.status(_('cloning subrepo %s\n') % self._relpath)
> > -            self._gitnodir(['clone', source, self._abspath])
> > +            self._gitnodir(['clone', self._abssource(source),
> > self._abspath])
> >         if self._githavelocally(revision):
> >             return
> >         self._ui.status(_('pulling subrepo %s\n') % self._relpath)
> > @@ -763,7 +768,7 @@ class gitsubrepo(abstractsubrepo):
> >         if self._githavelocally(revision):
> >             return
> >         # then try from known subrepo source
> > -        self._gitcommand(['fetch', source])
> > +        self._gitcommand(['fetch', self._abssource(source)])
> >
> 
> After reading the docs again, it looks like git fetch cannot take a plain
> URL as an argument, and that this command is behaving as a no-op.
> 
> Without going down the slippery slope of generating our own git remotes, it
> might be better to delete this line of logic, and only fetch from 'origin',
> the originally cloned repository.

Um.. ok? The above doesn't mean much to me. Your previous patch is
pushed, so feel free to send a follow-up.

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial-devel mailing list