views:

70

answers:

1

As a Git user, I find it inconvenient to set up multiple directories for multiple Mercurial remote repositories, as I want to quickly switch between them, especially when working in an IDE.

I'm trying to somehow replicate the remote branches system from git, where I can simply switch between branches and push to the one I choose.

How can I easily track multiple remote branches in the same directory with Mercurial?

+2  A: 

I am not a Mercurial guru, but this is the method I would try.

There is no direct method of doing this with Mercurial, but it can be accomplished using a combination of:

  1. The bookmarks extension
  2. Path entries in your hgrc file

The initial setup would require you to:

  1. Set your default path for pull to '.' (to prevent accidentally pushing to the wrong tracking branch when hg push is invoked with no arguments)
  2. Create a bookmark at your tip to represent the tip of master (in Git speak)

Then when you want to track a new remote:

  1. Create a path entry in your hgrc for the remote
  2. Create a bookmark for the remote

With that done your can do things like:

hg update tracking_branch_1  
hg pull remote_1  

...review the branch and decide if you want to merge...then

hg update master
hg merge tracking_branch_1
Tim Henigan
I don' think any of the bookmark stuff is necessary to achieve his goals. Just putting additional entries in `[paths]` sounds like all he was looking to do.
Ry4an