topics vs bookmarks and hg-git

Manuel Jacob me at manueljacob.de
Wed Jul 29 08:53:22 UTC 2020


On 2020-07-29 06:06, Manuel Jacob wrote:
> Bookmarks work best with hg-git, as they can be easily mapped to Git
> refs and back.
> 
> Mapping topics to Git refs ("Git branches") is possible by restricting
> each topic to have a single head and assigning a Git ref to each topic
> head. Mapping Git refs back to topics is not possible in general, as
> Git refs refer a single commit while the topic name is on all
> changesets in the topic.
> 
> If you use hg-git only for syncing from Mercurial to Git, but not the
> other way, you’ll find a not yet merged feature useful.
> 
> You can find it in the `export-additional-refs` topic of the hg-git
> repository. There’s no documentaion so far, but see the test case:
> 
> https://foss.heptapod.net/mercurial/hg-git/-/merge_requests/8/diffs?commit_id=7e2344def8a4f18aca8b4d49d45ad85c584136d5#diff-content-6af25606bfd4c7217ddbb5a602fab0c84988a0fa
> 
> The following configuration will export all topic heads to Git
> branches with the name of the topic:
> 
> [git]
> export-additional-refs.named-branch-heads:revset = head() and topic()
> export-additional-refs.named-branch-heads:template = refs/heads/{topic}

Oops, I left the "named-branch-heads" from where I copied the two lines. 
The name between the "export-additional-refs." and ":..." can be chosen 
freely. Multiple revset/template pairs can be added when using different 
names.

> With this configuration, if you push from Mercurial to Git and then
> pull from Git to Mercurial, all the topic heads will have a bookmark
> with the name of the topic, which is a mess of course. You could work
> around that by modifying the template to give them a different Git ref
> to avoid the naming clash, or add a hook removing the bookmarks, but
> then you won’t see if the Git side was updated.
> 
> On 2020-07-29 01:14, Ernie Rael wrote:
>> Can (should) I use topics, instead of bookmarks, with hg-git and 
>> github?
>> 
>> -ernie
>> 
>> _______________________________________________
>> Mercurial mailing list
>> Mercurial at mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial



More information about the Mercurial mailing list