How to change the default branch to push in mercurial?

Posted by timmfin on Stack Overflow See other posts from Stack Overflow or by timmfin
Published on 2010-05-05T23:26:15Z Indexed on 2010/05/05 23:38 UTC
Read the original article Hit count: 202

Filed under:
|
|
|

I like creating named branches in Mercurial to deal with features that might take a while to code, so when I push I do a hg push -r default to insure I'm only pushing changes to the default branch. However, it is a pain to have to remember -r default every since time I do do a push or outgoing command.

So I tried fix this by adding this config to my ~/.hgrc:

[defaults]
push = push -r default
outgoing = outgoing -r default

The problem is, those config lines are not really defaults, they are aliases. They work as intended until I try to do a hg push -r <some revision>. And the "default" I've setup just obliterates the revision I passed in. (I see that defaults are deprecated, but aliases have the same problem).

I tried looking around, but I can't find anything that will allow me to set a default branch to push AND allow me to override it when necessary. Anyone know of something else I could do?

ps: I do realize that I could have separate clones for each branch, but I would rather not do that. It's annoying to have to switch directories, particularly when you have shared configuration or editor workspaces.

© Stack Overflow or respective owner

Related posts about hg

Related posts about mercurial