37

I've installed the HgEclipse plugin for Mercurial integration in Eclipse. I have an existing (Java) project in Eclipse, but I can't figure out how to turn on mercurial change tracking for this existing project.

It seems I can do an import of a mercurial project (File > Import > Mercurial > Clone ...), but that's only for new Eclipse projects...

Of course, I can apply Mercurial via the command line, e.g. hg init in the project directory, but this doesn't get picked up in Eclipse.

So, how do I turn on Mercurial for existing Eclipse projects?

Rabarberski
  • 23,854
  • 21
  • 74
  • 96

2 Answers2

50

Right click on project go to "Team" -> "Share Project" select "Mercurial" and go through the wizard steps.

David Holbrook
  • 1,617
  • 14
  • 18
  • 2
    Perfect, thanks. I had seen that command, but hadn't understood it was for creating a mercurial repository. – Rabarberski Mar 26 '10 at 07:56
  • What do you do when "Apply patch" is the only thing in that menu? – NoBugs Mar 21 '12 at 18:56
  • 1
    Apparently I didn't have mercurial installed. I also had to uninstall and reinstall mercurial-eclipse, and it worked! – NoBugs Mar 24 '12 at 03:13
  • Note that this also works if you've already got an existing Mercurial repo in your project. I was hesitant to choose "Share Project" because I thought it would delete the repo and initialize a new one. That, happily, was no the case. – MrMas Dec 11 '15 at 22:31
  • As you would see if you went through these steps, this would also work for CVS or Subversion, if you have those plugins installed. I haven't tried it but it looks to be the case. – MrMas Dec 11 '15 at 22:33
6

When you are trying to push your project to your repository the above answer is correct for the initial part, but a step by step would be more like this:

  1. Create project(or maybe it is already created)
  2. Right click the project
  3. Mouse over team
  4. Click "Share Project..."
  5. Select Mercurial then click next
  6. Click Finish
  7. Right click on project again and mouse over team
  8. Click "Push..." (it is important to commit before pushing 99% of the time)
  9. Type in the url of your repository(repo)
  10. Type in username and password then click finish
nullsage
  • 61
  • 1
  • 2
  • I followed these instructions, and in steps 5-6 I created a local Hg repo. However, I dont get a "Push" option at step 8. What am I doing wrong? – aaa90210 Mar 08 '12 at 13:03