2

How can I only push the needed HEADS of a subrepo from within the parent repo.

I've started using a bookmark style process for local feature branches in mercurial. It works great so far, just commit, bookmark and switch in and out of that head to work. I can push and pull just fine by specifying hg push -r master-bookmark to only push my main head and not any feature branches.

The problem comes when I use multiple heads with bookmarks in a subrepo. Because it means I cannot just use hg push -r master-bookmark because it then tries to push all the heads of the subrepo. I don't want these heads going public until I'm ready but I need to get some other changes out within the parent, so I'm not forcing them.

I've tried dropping into the sub-repo and pushing what I need, but the parent will still try and push everything regardless of whether it's in the ancestry of the `.hgsubstate'.

Any one got any ideas on what kind of workflow is best for this? I'd rather not have to disable the sub-repo, push, then re-enable, that will get very messy.

Paystey
  • 3,287
  • 2
  • 18
  • 32
  • Not exactly the same question, but the answers might help you too (especially Ry4an's one): [Mercurial Subrepositories: Prevent accidental recursive commits and pushes](http://stackoverflow.com/q/4856883/151299) – Oben Sonne Jan 07 '13 at 19:21

1 Answers1

4

You could take advantage of the phases feature that makes this sort of workflow quite easy.

https://www.mercurial-scm.org/wiki/Phases

When you make a branch/bookmark/commit phase secret it's not pushed unless you explicitly do so. It's a great way to flag work that's not yet ready to share.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169
  • Aha! I only first read about phases today, and they struck me as very useful, information wise. I never thought of using them within the workflow. I'll try this tomorrow and see how it works out. Thanks. – Paystey Jan 07 '13 at 23:04