Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get MercurialEclipse and Bitbucket to talk to each other?

I'm an Eclipse user, but I'm a newbie to Mercurial and to Bitbucket. I think I understand the command-line hg commands. I can create repositories, clone, push, pull, update, that stuff.

If I have a project in Eclipse, I can create a local repository for it. I can't figure out how to clone this repository up to Bitbucket.

If I have a project in Eclipse, I can create a remote repository on Bitbucket. Then I don't have a local repository, so I can't use any of the Team... commands, and can't do anything.

If I have a repository on Bitbucket, I can't get to it, because I don't have a local repository, so again I can't do anything.

If I create separate repositories locally and on Bitbucket, then I have two different repositories, and I don't know enough Mercurial to merge(?) different repositories.

There must be some blindingly obvious to get a project off the ground, but I'm blind to it. I can do this just fine from the command line, but MercurialEclipse is defeating me. No luck so far with Google and assorted documentation...

Help?

like image 677
David Matuszek Avatar asked Mar 25 '11 15:03

David Matuszek


2 Answers

Doing it using Eclise "Team" UI:

  • Create a project in Eclipse and "share" it using Mercurial repository type. That will create local repository (by default in the same location where your project is).

  • Create project repository on BitBucket.

  • Use "Team">"Push" to push local changes to your remote BitBucket repo. First time it will ask you to enter the repository URL, user name and password. All this information is available on your Bitbucket web UI.

Don't forget that you have to do 2 stage commits after that. Commit in Eclipse UI will commit it in your local repository. In your team perspective's Synchronize view you will see additional "Outgoing" and "Incoming" entries. Using right-click menu on them you will be able to push/pull your changes to/from your BitBucket repo.

Remote repo information can be managed in special "Mercurial Repositories" view.

More info can be found in the tutorials at http://ekkescorner.wordpress.com/blog-series/git-mercurial/

like image 141
Eugene Ryzhikov Avatar answered Nov 05 '22 13:11

Eugene Ryzhikov


Following the directions provided by bitbucket should be enough.

You can either create a repository on bitbucket and clone it on your desktop:

hg clone https://bitbucket.org/youraccount/yourproject
...
hg pull -u # to pull changes and update
hg push # to push changes to this repo

Or use a local repository and push these changes to a newly created repository on bitbucket:

cd /path/to/existing/hg/repo/
hg add [...]
hg commit 
hg push https://bitbucket.org/youraccount/yourproject

Basically, two repositories are "bound" by:

  • a common changeset in their history
  • the [paths] configuration in /path/to/existing/hg/repo/.hg/hgrc, that lists remote repositories you can read/push to.
like image 42
Brian Clozel Avatar answered Nov 05 '22 14:11

Brian Clozel