Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

solving Mercurial and IntelliJ IDEA project root mismatch?

I have a mercurial repository which has several projects (from an IntelliJ IDEA sense) within it. for example, I might have:

foo/
    projects/
          project1/
                  .idea/
          project2/
                  .idea/

I can push,pull,commit etc fine with command-line and TortoiseHG. I've enabled Mercurial (hg4idea plugin) within IntelliJ yet almost nothing seems to be working. If I add a source code file it doesn't get added, for files I've added manually they show no changes. In IntelliJ the Mercurial menu is enabled but "add to VCS" is always greyed out. However, IntelliJ correctly lists available changesets from a remote repository.

In the Version Control window for commands like "hg status" I get errors like:

abort: repository C:/foo/projects/project1 not found!

Commands like "hg incoming" seem to be succeeding.

I suspect this might be because the project root (project1) is below the repository root (foo). Does anyone know how to resolve this problem? Is there a configuration change I can make? If so, where in the settings is it?

I'm using the latest (10.0.3) IntelliJ IDEA Community edition.

like image 225
Nick Fortescue Avatar asked Apr 15 '11 10:04

Nick Fortescue


1 Answers

I managed to work this one out myself. When you enable the project for Mercurial, IntelliJ sets the project root by default as the mercurial repository directory. With the help of this help page I worked out this was what I needed to change.

  1. Go to the Settings dialog (File-Settings)
  2. Choose Version Control
  3. At the top level it shows a list of Directories and VCS's, mine said "project root" and "Mercurial"
  4. Click "Remove" to remove the existing mapping.
  5. Click "Add" to add a mapping, and use the "..." button to choose the mercurial root - "foo" in the example above.

This changes the vcs.xml file in the .idea directory.

like image 161
Nick Fortescue Avatar answered Nov 10 '22 06:11

Nick Fortescue