git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] [SIGNED-OFF] remotes-hg: bugfix for fetching non local remotes

From
Jörn Hees <dev@joernhees.de>
Date
Jul 24, 2013, 09:59 UTC
Message-ID
<F0461ED2-7B5F-4657-B0D4-3CBBE15FDD48@joernhees.de>
In-Reply-To
<CALWbr2zRsCk1N5xUUDQeWX6CbvLHYWnxiYpea+etoWvXHNhPEA@mail.gmail.com>
Hi,
On 24.07.2013, at 10:52, Antoine Pelisse <apelisse@gmail.com> wrote:
> 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)
Maybe ".git/hg/.share"?
Show 18 quoted lines
> 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).
I like the idea of having independent remotes (fetching one, doesn't update another). http://mercurial.selenic.com/wiki/ShareExtension warns about this, and i wasn't sure it wouldn't cause intricate bugs. This is why I opted for the explicit cloning, no shared history for several remotes.

I'd really like some feedback on this one as he probably knows the hg internals well enough that he can make a more educated guess on this than I can: when you import several hg remotes and fetch them / push to one, wouldn't such a shared repo cause problems? If unsure i still opt for my version as it keeps things isolated at the cost of some optimization.

Show 6 quoted lines
>> 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 ?
Yupp, the shared_paths won't be shared, so it's not as optimal as possible, but it will work at least ;)

Cheers, Jörn

Previous: Antoine PelisseNext: Antoine Pelisse
Message 3 of 9 in “[SIGNED-OFF] remotes-hg: bugfix for fetching non local remotes”
  1. [SIGNED-OFF] remotes-hg: bugfix for fetching non local remotesJoern Hees, Jul 23, 2013
  2. Antoine PelisseJul 24, 2013
  3. Jörn HeesJul 24, 2013
  4. Antoine PelisseJul 24, 2013
  5. Jörn HeesJul 24, 2013
  6. Junio C HamanoJul 24, 2013
  7. Jörn HeesJul 24, 2013
  8. Junio C HamanoJul 24, 2013
  9. Felipe ContrerasJul 25, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.