git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Antoine Pelisse <apelisse@gmail.com>
To: Joern Hees <dev@joernhees.de>
Cc: Junio C Hamano <gitster@pobox.com>, git <git@vger.kernel.org>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: Re: [PATCH] [SIGNED-OFF] remotes-hg: bugfix for fetching non local remotes
Date: Wed, 24 Jul 2013 10:52:12 +0200	[thread overview]
Message-ID: <CALWbr2zRsCk1N5xUUDQeWX6CbvLHYWnxiYpea+etoWvXHNhPEA@mail.gmail.com> (raw)
In-Reply-To: <1374615616-4730-1-git-send-email-dev@joernhees.de>

On Tue, Jul 23, 2013 at 11:40 PM, Joern Hees <dev@joernhees.de> wrote:
> 6796d49 introduced a bug by making shared_path == ".git/hg' which
> will most likely exist already, causing a new remote never to be
> cloned and subsequently causing hg.share to fail with error msg:
> "mercurial.error.RepoError: repository .git/hg not found"

Indeed, no clone is performed if the .git/hg dir already exists.
I think it assumes that it's already done.
That will certainly lead to the failure you are reporting.

Also, the directory can be created to store marks for a local repository.
remote-hg won't require nor do a local clone in .git/hg for local repositories.

It should also be noted that once .git/hg is not empty, it will no
longer be possible to create a mercurial repository in there (it will
die with "destination '.git/hg'  is not empty")

I think the best way would be to create the shared repository in
.git/hg/$share, with $share being a path that can't be a remote name
(so that it doesn't conflict with remote directories),
and then apply the following patch (copied in gmail)

diff --git a/contrib/remote-helpers/git-remote-hg
b/contrib/remote-helpers/git-remote-hg
index 0194c67..21c8091 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -390,7 +390,7 @@ def get_repo(url, alias):
         if not os.path.exists(dirname):
             os.makedirs(dirname)
     else:
-        shared_path = os.path.join(gitdir, 'hg')
+        shared_path = os.path.join(gitdir, 'hg', $share)
         if not os.path.exists(shared_path):
             try:
                 hg.clone(myui, {}, url, shared_path, update=False, pull=True)

That way, the share can be created even if .git/hg already exists
(because of a previous import, before the shared machinery existed, or
because you already have a local remote).

> Changing gitdir to dirname causes shared_path ==
> .git/hg/<remote_name>/hg. The call to hg.share with local_path ==
> .git/hg/<remote_name>/clone works again.

I think that will be a problem, because then the shared_path will no
longer be shared, will it ?

  reply	other threads:[~2013-07-24  8:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 21:40 [PATCH] [SIGNED-OFF] remotes-hg: bugfix for fetching non local remotes Joern Hees
2013-07-24  8:52 ` Antoine Pelisse [this message]
2013-07-24  9:59   ` Jörn Hees
2013-07-24 13:14     ` Antoine Pelisse
2013-07-24 14:21       ` Jörn Hees
2013-07-24 15:20       ` Junio C Hamano
2013-07-24 15:28         ` Jörn Hees
2013-07-24 22:51           ` Junio C Hamano
2013-07-25 19:30       ` Felipe Contreras

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=CALWbr2zRsCk1N5xUUDQeWX6CbvLHYWnxiYpea+etoWvXHNhPEA@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).