How to fix Mercurial stuck on Git subrepo push?

  • I have a root Mercurial repo (website).
  • I am cloning WordPress from a GitHub mirror into a /wp subdirectory.
  • Since I want a very specific (stable) version of WP, but without the current development, I do git checkout 3.4.1 (where 3.4.1 is the tag).
  • I configure it as subrepo in the root Mercurial repo and commit (WP review gets a fixed tone in .hgsubstate ).

And here the problem begins. I do hg push and when it gets to WP:

 no branch checked out in subrepo wp cannot push revision e9bc63e25dc40c07ac3a6778dc2b48e1aa486e36 

And then he just leaves. Push for root repo is not even attempted.

I understand why Mercurial is trying to push subrepo (the alleged behavior), but I cannot understand why it succeeds in completely failing in subrepo, which:

  • no change
  • has read-only status

How do I know that I want this particular revision, and I don’t want it to mess with Git subrepo?

+7
source share
1 answer

You will have problems with this setting.

Firstly, it seems that mercurial cannot handle the git subfield with HEAD detached .

When you run git checkout 3.4.1 , your repo goes into a disabled state of HEAD (you should have seen a warning about this when executing the command). At this point, if you run git branch , you will see that (no branch) appears as the active branch. When mercury attempts to push, he suffocates from this condition. You may ask a list of mercurial developers why this is happening, but this is probably a limitation of the existing subrepo implementation.

Secondly, mercurial uses the push command to synchronize git subrepos .

If you were to run git checkout -b <integration_branch> 3.4.1 , it moves git from the detached state of the HEAD state. However, when you try to execute hg push , it will try to actually push the remote git repository. For Mercurial sub-mode, it can check outgoing changes even if you do not have push access to the remote control. However, GitHub requires you to authenticate before it tells you whether the two repositories are synchronized. So, if you do not have push access to the remote git device, this will crash. This is part of the design of the Merurial Subrepo strategy.

If you need to continue this setup, you should probably do the following:

  • Build your own WordPress repo fork on GitHub.
  • Copy your plug into the mercurial subrepo directory.
  • git checkout -b <branch_name> 3.4.1
  • Continue from there

There is additional information in this question .

+2
source

All Articles