views:

36

answers:

1

I came on board about 6 months ago, and when I arrived, my group was using NO form of versioning. I have since convinced mgmt to use Mercurial in new projects, so we have on our webserver the following structure:

-MainFolder (which includes files for the main project)
  +Subfolder A, which contains (old) project A with NO hg repo
  +Subfolder B, which contains (old) project B with NO hg repo
  +Subfolder C, which contains (NEW) project C AND a hg repo
  +Subfolder D, which contains (NEW) project D AND a hg repo

Note that the only folders which currently have a repo are subfolders C and D, which represent seperate projects.

I would like to add a repo to track everything which is currently not tracked, but want to ignore the folders which currently have their own repositories. I know about using .hgignore files, but from what I understand that would require me to explicitly ignore every folder which contains a repo. This isn't a problem in the above example (with only two existing repos), but our actual setup has more projects than this.

Is there any way to tell Mercurial to dynamically ignore all folders which have a repo in them, and track everything else?

+3  A: 

It will already do this out of the box. Try the following demonstration:

hg init demo
cd demo
hg init foo
cd foo
echo foo>>foo.txt
hg stat
? foo.txt
cd ..
hg stat
# Nothing!

You should probably look into setting up the main repos to use subrepositories for tracking changes in the folders that already have their own repos. If you don't do that, changes in one of those projects wouldn't automatically be committed when you commit in the main.

Niall C.
Well I feel silly. Thanks! Now to think of an explanation for why this will take me at least a month to implement (so I don't have to do anything for a month) :D
loneboat