> On Tue, Apr 18, 2023 at 1:03 AM Uwe Brauer <o...@mat.ucm.es> wrote:


> It does here.

>   (
>   git init git-repo
>   cd git-repo
>   echo one > content
>   git add content
>   git commit -m 'one'
>   )

>   hg init hg-repo

>   (
>   git clone git-repo proxy-repo
>   cd proxy-repo
>   git remote add -f hg-repo hg::../hg-repo
>   git push hg-repo remotes/origin/master:refs/heads/branches/master
>   )

Ok, I settled it. The problem is that the repository 
https://git.code.sf.net/p/matlab-emacs/src matlab-emacs-src
(or the mirror at g...@gitlab.com:kalthad/matlab-emacs-default.git)
is a strange one. It was created as CSV, then converted to git (either
directly or via mercurial, I don't recall).

Be it as it may, it is utmost import to push in the correct order (so
master/default as the last branch).
Since git does not have a native support to localize the branch base (as
we discussed), 

    1. I either followed the proposal found in
       namely git log --all --oneline --decorate --graph --first-parent

    2. And I also cloned the repository again with hg-git, and run hg bookmarks

Both told me

| 197:b9f449756224 | strings       |
| 441:3dddc612b35f | modernize     |
| 449:18c23a5d8b5a | documentation |
| 455:5771ddf2e50d | mac_init      |
| 486:c95faee8b690 | usage1        |
| 496:b4410de703dc | shellcomplete |
| 657:1842e54161be | wisent-parser |
| 672:c81bebb99ebb | hairyblocks   |
| 679:fea497d36b67 | copyright     |
| 684:5a39cee1856e | fontlockhang  |
| 689:ee371bfe7da4 | default       |

So I used the command, you recommended, namely 
git remote add hg-remote hg::../mercurial-matlab-emacs-default/
git push hg-remote remotes/origin/strings:refs/heads/branches/strings

Etc etc

This works nicely, save one, alas important, detail: 

your script does not copy the git
hashed. Mercurial since quite some time supports to display the
mercurial and the git hashes. (The options for the log template are 

note for the hg hashes

gitnode for the git hashes

Here is an example, using for the repository I have cloned with the
hg-git plugin.

log  -G --template "{rev}\nChangeset: {node|short}\nCommit: {gitnode|short}

@ commit 689
│  Changeset: ee371bfe7da4b6e6cefd369dd8452c79b14a8709
│  Commit: b7007223bd7c99b9d92911c66411b2143a791ce4
│  Author: John Ciolfi <cio...@ah-ciolfi620-l.dhcp.mathworks.com>
│  Date: Mon, 10 Apr 2023 16:05:31 -0400
│  matlab and org mode example

And here is what git log shows for the cloned git repository

* commit b7007223bd7c99b9d92911c66411b2143a791ce4 (HEAD -> default, 
origin/default, origin/HEAD, hg-remote/branches/default)
| Author: John Ciolfi <cio...@ah-ciolfi620-l.dhcp.mathworks.com>
| Date:   Mon Apr 10 16:05:31 2023 -0400
|     matlab and org mode example

Now the mercurial repository generated by your script gives me 

@  commit 689
│  Changeset: b5ac75bb769d915d9891d6e7ef19f9ec546b67d1
│  Commit:
│  Author: John Ciolfi <cio...@ah-ciolfi620-l.dhcp.mathworks.com>
│  Date: Mon, 10 Apr 2023 16:05:31 -0400
│  matlab and org mode example

So as you can see the git hashed was not copied.
So if I wished to use that repository and push via hg-git I cannot
because hg tells me that there are commits missing and when I pull, he
just pulls everything his way (that is converting git branches into
bookmarks) and so doubling the commits!

I see two solutions here

    1. Your scripts copies the git hashes. That would be simply great
       because it would allow a round trip. Unfortunately, you told me,
       that you, stopped the development.

    2. I work on the converted repository, but then pull from the git
       repository and then push the pull commits to the remote server.
       However some questions

       1. If I create a hg named branch and I pull it, will it be
          translated into a git branch.

       2. What happens if I use the evolve extensions (which hides
          certain commits), would everything pulled, or would the hidden
          be ignored (as say should be).

I will run some experiments first with a simple commit on the main
branch (now called default) but this should not be a problem.

Thanks again for this tool


Uwe Brauer 

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to