title: What is the correct way to handle nested Hg repositories with Mercurial/TortoiseHg?
body: <p>I'm struggling on how to correctly track nested repositories using TortoiseHg.</p>
  
  <p>I have a main repository that tracks my whole project. This project contains several little plugins that are stored inside a plugins/ subdirectory.</p>
  
  <p>I would love to track each plugin independently (committing and pushing to BitBucket for each one of them) while still being able to make a "whole" commit of my project, including the changes made to the plugins and pushing it to an other location (not BitBucket).</p>
  
  <p>What I've done so far is creating a new repo for each of my plugins. I can commit and push them to BitBucket easily. But when I went to commit my "main" repository, TortoiseHg displays an error message saying that <code>abort: path 'mainrepo\\plugins\\plugin1\\plugin1.php' is inside repo 'mainrepo\\plugins\\plugin1'</code>.</p>
  
  <p>I can see that I'm doing something wrong, but I can't tell what.</p>
  
  <p>I'm using a nightly of both Mercurial and TortoiseHg (ToirtoiseHg version 0.9.3+237-ea50f793bbe4 and Mercurial-1.4.3+225-70dea42c9406) on WinXP. I read that subrepos handling was added to this TortoiseHg build, but, well, I'm not even sure subrepos is the feature I'm supposed to use here.</p>
  
  <p><strong>Update</strong><br>
  I've made some progress, but still can't get it to work the way I'd like.<br>
  Here is my structure :</p>
  
  <pre><code>-- .hg
  -- core
  -- app
      -- file.php
      -- file.css
      -- plugins
          -- plugin1
              -- file1.php
          -- plugin2
              -- file2.php
  </code></pre>
  
  <p>I went to app/plugins, and cloned a plugin (named plugin3) from BitBucket here. I then created a .hgsub file at the root and added <code>app/plugins/plugin3 = app/plugins/plugin3</code> to it.
  I was then able to commit my whole directory.</p>
  
  <p>But then I tried to grab the latest version of plugin1 from BitBucket, so I went to app/plugins, deleted the plugin1/ folder and cloned the plugin1 from BitBucket. I then added <code>app/plugins/plugin1 = app/plugins/plugin1</code> to .hgsub but when I tried to commit it I was greeted with <code>abort: path 'app/plugins/plugin1/file1.php' is inside repo 'app\\plugins\\plugin1'</code></p>
  
  <p>The problem seems to fire when my subrepo holds the same name as a directory already tracked by Hg in the plugins/ directory.</p>
  
  <p>What am I doing wrong ? Should I add/edit something special in the .hg of my plugins ?</p>
  
  <p><strong>Update</strong><br>
  I've finally managed to get it to work the way I want.<br>
  I had to "manually" tell Mercurial to remove the plugins/plugin1, plugins/plugin2 directories, commit the change, then clone back the plugin1 and plugin2 from BitBucket, add <code>app/plugins/plugin1 = app/plugins/plugin1</code> to .hgsub and commit all. It worked.<br>
  The important step was committing after having deleted the plugin1/plugin2 folders.</p>