[PATCH] subrepo: expand relative sources for git subrepos

Eric Eisner ede at mit.edu
Tue Feb 22 14:44:01 CST 2011


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.

-Eric Eisner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20110222/16fe6044/attachment.htm>


More information about the Mercurial-devel mailing list