git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Antoine Pelisse <apelisse@gmail.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: Joern Hees <dev@joernhees.de>, Junio C Hamano <gitster@pobox.com>,
	git <git@vger.kernel.org>
Subject: Re: [PATCH v3] remotes-hg: bugfix for fetching non local remotes
Date: Thu, 25 Jul 2013 21:53:19 +0200	[thread overview]
Message-ID: <CALWbr2wN6k8JBCwLFC=TjTC_sg7Uh8AEsMOBKfH9aBxDEcV4oQ@mail.gmail.com> (raw)
In-Reply-To: <CAMP44s16bRx0p_F=PTcy9bekg_5TVC_GsQjzOev6xkpCEWcjAw@mail.gmail.com>

On Thu, Jul 25, 2013 at 9:12 PM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:
> Besides, I don't see
> the point of having a '.shared/.hg' directory, and nothing else on
> that '.shared' folder.

Is it not already true about the ".git/hg/$alias/clone/" directory ?

> So, here's my patch. If only Junio read them.
>
> Subject: [PATCH] remote-hg: add shared repo upgrade
>
> 6796d49 (remote-hg: use a shared repository store) introduced a bug by
> making the shared repository '.git/hg', which is already used before
> that patch, so clones that happened before that patch, fail after that
> patch, because there's no shared Mercurial repo.
>
> It's trivial to upgrade to the new organization by copying the Mercurial
> repo from one of the remotes (e.g. 'origin'), so let's do so.

I agree with you that we should consider migration. But there's
another use-case I think can fail.
What happens with the following:

git clone hg::/my/hg/repo
cd repo && git remote add newremote hg::http://some/hg/url

Git clone will create .git/hg/origin and with no hg clone (because
it's a local repository), and then create marks-file in there.

> Reported-by: Joern Hees <dev@joernhees.de>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  contrib/remote-helpers/git-remote-hg.py | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/contrib/remote-helpers/git-remote-hg.py
> b/contrib/remote-helpers/git-remote-hg.py
> index 0194c67..57a8ec4 100755
> --- a/contrib/remote-helpers/git-remote-hg.py
> +++ b/contrib/remote-helpers/git-remote-hg.py
> @@ -396,6 +396,13 @@ def get_repo(url, alias):
>                  hg.clone(myui, {}, url, shared_path, update=False, pull=True)
>              except:
>                  die('Repository error')
> +        else:
> +            # check and upgrade old organization
> +            hg_path = os.path.join(shared_path, '.hg')
> +            if not os.path.exists(hg_path):
> +                repos = os.listdir(shared_path)
> +                local_hg = os.path.join(shared_path, repos[0], 'clone', '.hg')
> +                shutil.copytree(local_hg, hg_path)

With the use-case I described above, I think shutil.copytree() would
raise an exception because local_hg doesn't exist.

  reply	other threads:[~2013-07-25 19:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25  0:42 [PATCH v3] remotes-hg: bugfix for fetching non local remotes Joern Hees
2013-07-25 19:12 ` Felipe Contreras
2013-07-25 19:53   ` Antoine Pelisse [this message]
2013-07-25 20:40     ` Felipe Contreras
2013-07-25 21:10       ` Antoine Pelisse
2013-07-26  1:30         ` Junio C Hamano
2013-07-26 12:17         ` Jörn Hees
2013-08-04 10:38           ` [PATCH] remote-hg: Fix cloning and sharing bug Antoine Pelisse
2013-08-04 12:17             ` Jörn Hees
2013-08-04 13:31               ` Felipe Contreras
2013-08-04 13:51                 ` Jörn Hees
2013-08-04 14:00                   ` Felipe Contreras
2013-08-04 13:59                 ` Antoine Pelisse
2013-08-04 14:24                   ` Felipe Contreras
2013-08-04 13:22             ` Felipe Contreras
2013-07-26 12:16   ` [PATCH v3] remotes-hg: bugfix for fetching non local remotes Jörn Hees

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALWbr2wN6k8JBCwLFC=TjTC_sg7Uh8AEsMOBKfH9aBxDEcV4oQ@mail.gmail.com' \
    --to=apelisse@gmail.com \
    --cc=dev@joernhees.de \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).