Alternative to sourcehut
Manuel Jacob
me at manueljacob.de
Mon Aug 26 02:15:39 UTC 2019
On 2019-08-25 14:23, Uwe Brauer wrote:
>> On 2019-08-25 11:39, Uwe Brauer wrote:
>
> > Hg-git can do it. When converting from HG to Git, the branch name
> > will be noted in the "--HG--" section. When converting back from
> Git
> > to HG, the branch name will be restored.
>
> This is really great (and would explain, why I cannot see the full
> graph
> in helix nor in sourcehut)
>
> However I just run a short test and it did not seem to work
>
> I am running
> hg version 5.0.1+3-d532292eff22+20190614)
>
> Hg git
>
> changeset: 1169:2135ddef6d6e
>
>
>
> 1. I created a git repo with git, made 3 commits.
>
> 2. I cloned the repo with hg (and hg-git)
>
> 3. I added named branch and two commits.
>
> 4. I pushed but obtained.
>
>
>
> searching for changes
> no changes found
Mercurial and Git have a different view on what’s in the repository.
For Mercurial, everything ever added to the repository is considered
part of the repository (unless the history was modified later). For
Git, only commits reachable from some "ref" (every Git branch with the
name "BRANCH" creates a ref "refs/heads/BRANCH") are considered part of
the repository. For that reason, it doesn’t make much sense to push
something to a Git repository if it’s not reachable from some ref.
Hg-git will, for each bookmark with the name "BOOKMARK", create a ref
"refs/heads/BOOKMARK". So if you add a bookmark (or move the master
bookmark) to the head of the named branch you created, it will be
pushed.
> > For automatically generating Git branches out of HG branches, this
> > patch could be useful:
> > https://groups.google.com/d/msg/hg-git/U6RN9unOUBk/O01l_AmhBQAJ
>
> Now I am confused. Are you saying that it only works with this patch?
What I described above works without the patch, but you have to add
bookmarks manually.
The patch makes it possible to automatically add a Git ref. If
configured correctly, you can save the work of adding the bookmark / ref
yourself.
If you add this to the repository’s hgrc,
[git]
export-additional-refs.named-branch-heads:revset = head()
export-additional-refs.named-branch-heads:template =
refs/heads/hg_named_branch/{branch}
it will, for the head of each Mercurial branch with the name "BRANCH",
create a Git ref "refs/heads/hg_named_branch/BRANCH", or in other words
a Git branch with the name "hg_named_branch/BRANCH".
When you pull again from the Git repository, you will see additional
bookmarks. This is maybe a bit annoying, but the functionality was
originally designed for unidirectional Mercurial -> Git syncing.
> So this is not the official version, or a very recent one?
>
> To which hg-git version this patch should be applied to?
If you scroll up in the link, you see that it’s the second patch in a
patch series of two. Probably you need to apply both patches to avoid
merge conflicts (the first one is also useful to catch the error that
the same ref was added for different changesets). Originally these
patches have been developed on top of
2135ddef6d6e93afd8998ca824efd4680d4f1830, but they should apply also to
the tip of https://bitbucket.org/durin42/hg-git .
> Thanks
>
> Uwe
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
More information about the Mercurial
mailing list