title: How to add subprojects to a main project in mercurial?
body: <p>I'm new to mercurial and tortoise and I have some problems trying to understand how to work with sub-projects.</p>
  
  <p>I have three folders called <strong>UART</strong>, <strong>SPI</strong> and <strong>ADC</strong>. These folders contain code to use the uart, spi and adc for a microcontroller family. These code <em>is not tied to any project and on the contrary, this code is designed and developed individually to be used in any project</em>. So, I created a repository for each one and have them under version control with hg.</p>
  
  <p>But recently I decided to start a project called <strong>"Project A"</strong> which uses the <em>ADC</em> and the <em>UART</em>. I create the "Project A" folder, create a main.c file, and finally create a repository in the "Project A" folder, add the main.c file, and commit it.</p>
  
  <p>My problem here is that I want to somehow <strong><em>"add" or "link"</em></strong> the UART and ADC code to my <strong>"Projet A"</strong> without copy-paste the folders manually, I mean, to handle the UART and ADC code as sub-projects independent from the "Project A" and have hg to copy the most recent version for UART and ADC to the "main" project. Then if a change is needed in UART code for example, then the change is made in the UART code, commit the change to the UART project and just "update" it to the last version whithin all projects that have UART code added or linked.</p>
  
  <p>I have read:</p>
  
  <p><a href="https://stackoverflow.com/questions/6528112/mercurial-add-project-which-is-not-within-repository-folder">Mercurial - Add project which is not within repository folder</a></p>
  
  <p><a href="https://stackoverflow.com/questions/15798696/do-all-files-have-to-be-in-the-repository-folder-when-using-mercurial?lq=1">Do all files have to be in the &#39;repository folder&#39; when using Mercurial?</a></p>
  
  <p><a href="http://hginit.com/index.html" rel="nofollow noreferrer">http://hginit.com/index.html</a></p>
  
  <p><a href="https://stackoverflow.com/questions/1170338/mercurial-for-beginners-the-definitive-practical-guide">Mercurial for Beginners: The Definitive Practical Guide</a></p>
  
  <p>And I can't find the answer to my question. I found a very neat and straight-to-the-point tutorial about subprojects but it didn't really help (<a href="http://tomtech999.wordpress.com/2011/12/17/getting-started-with-mercurial-subrepositories/" rel="nofollow noreferrer">http://tomtech999.wordpress.com/2011/12/17/getting-started-with-mercurial-subrepositories/</a>
  )</p>
  
  <p>Could you give me a series of steps to follow or a link to some tutorial to accomplish this?</p>
  
  <p>Regards!</p>