0

Say I have a project like this in Mercurial

root/
  proj1
  proj2

If I open proj1 in IntelliJ, I will have to set the VCS root to "root" or else IntelliJ won't show any changes. But, if I do so I will also see changed files in proj2. How can I exclude proj2 or set the root to proj1 while still seeing my changes?

2 Answers 2

1

You can hide folders in File -> Project Structure... -> Modules

Select your module, then select your folder, that you want to hide and then click to "Excluded".

enter image description here

1
  • Hmm, maybe that's one way to do it. However, I want to create the project from proj1 and not from root. In my case, I have 20+ modules, so it would be inconvenient to have to exclude 19 modules for every individual module I want to open. Apr 24, 2012 at 0:18
0

This can be tricky because mercurial is intended to be used as One Project One Repo. By default mercurial will want to commit all files when an hg commit is ran. There is a command to commit specific files that is rarely used: hg commit -I file1.foo -I file2.foo -I file3.foo. So you are basically trying to tell IntelliJ to constantly run that type of command, but pretend you don't see the other files to know you need to run that type of a command.

When you go to commit in IntelliJ if you use the commit dialog you can see the files it wants to commit. You can uncheck the files from proj2. Usually IntelliJ remembers to continue to ignores these files from future commits, but if you select the commit dialog differently they may appear checked again.

Realistically you should pull each project out to their own repository. Then this and many other potential problems with the setup goes away. Read One Project One Repository - Mercurial Used Right for reasons why.

4
  • OK, fair enough. We are actually doing "one project - one repo" in my current project now, but then the challenge is to hg pull all 20 repos all the time and never forget.. :) Apr 26, 2012 at 1:25
  • Cool, I hope it gets easier as you progress. That is a common transition phase that makes it difficult to switch mindsets. Often the route we suggest is hopefully your using Maven, and then if you can get CI like Jenkins building those 19 dependencies for every push, and you have it deploy the built jar or whatever it is to a nexus repo, when you build your one project, it will pull just the jars it needs to build, so you don't have to check everything out. That of course is a process to get CI, but mercurial is the first step. Now to work on the rest =). Apr 26, 2012 at 20:44
  • Yeah, actually we have exactly that setup. I just forget to pull and push sometimes, which makes it a bit messy if I start working on a module without remembering to pull. Apr 27, 2012 at 6:48
  • Slightly unrelated, but I really recommend SourceTree (sourcetreeapp.com) for keeping track of a lot of repos. Apr 27, 2012 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.