Search code examples
version-controlmercurialopen-sourcebitbucket

How to manage common source files in source control?


I have the following directory structure:

enter image description here

CommonUtilities, DataStructure1 and DataStructure2 contain source files used by one or more projects.

I would like to publish one or more projects as open source using Mercurial and BitBucket. But I don't know how to manage the source files used by one or more projects.

I am new to source control and to software development in general, so I would like to know the best practices in this kind of situation.

Should I:

  1. Include the common source files in more repositories as needed? (that is hg add them to two or more repositories)

  2. Include the common files in some other way than hg add?

  3. Do something completely different?


Solution

  • Option 3: Do something completely different.

    You can use the subrepository feature: keep the common files in a different repo, then reference them from your repository.