hg-git named branches, a new patch and problem

Manuel Jacob me at manueljacob.de
Tue Aug 27 22:22:42 UTC 2019


On 2019-08-27 22:03, Uwe Brauer wrote:
>> On 2019-08-27 18:03, Uwe Brauer wrote:
> 
>    > From documentation of "hg commit": "The --close-branch flag can be
>    > used to mark the current branch head closed. When all heads of a
>    > branch are closed, the branch will be considered closed and no 
> longer
>    > listed."
> 
> Do you mean
> hg close-head master -m "Close the head with the master bookmark"
> 
> Did not help.
> 
> Here is the script I used and it still fails.
> 
> 
> 
> mkdir git-repo
> cd git-repo
> git init
> echo 1 > 1
> git add 1
> git commit -m 1
> echo 1.1 > 1
> git add .
> git commit -m 1.1
> git checkout -b foo master~1
> echo 1.2 > 1
> git add .
> git commit -m 1.2
> echo 1.2.1 > 1
> git add .
> git commit -m 1.2.1
> git checkout master
> cd ..
> hg clone git-repo hg-clone
> cd hg-clone
> hg branch test-named
> echo testbranch1 >> 1
> hg commit -m "testbranch1"
> echo testbranch2 >> 1
> hg commit -m "testbranch2"
> hg close-head master -m "Close the head with the master bookmark"
> hg push
> 
> It does not work

It seems like you have configured the revset "head()" in option 
"export-additional-refs.named-branch-heads:revset".  "hg log -r 
'head()'" shows three changesets, two of them in the default branch.  
That won’t work with the template "refs/heads/hg_named_branch/{branch}" 
because the Git ref won’t be unique.  It does however work with the 
revset "head() and not closed()".

>    > The example I previously sent should work if each branch has only 
> one
>    > head.  For more complex scenarios, more complex revsets are 
> needed.
> 
> 
> Which example. Do you mean a script similar to mine?

I meant the following example configuration:

[git]
export-additional-refs.named-branch-heads:revset   = head()
export-additional-refs.named-branch-heads:template = 
refs/heads/hg_named_branch/{branch}

> It would be really great to have a working example to see what can be
> done and what not with your patch.
> I think my script presents a rather realistic Scenario. The starting
> point is a git repository with at least two branches.
> 
> (Right now I am rather sceptical that named branches can be used when
> pushing and pulling via the hg-git plugin to a git repository)
> 
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial



More information about the Mercurial mailing list