I have a Git repository and I need to use a library
that is delivered as source code that uses Mercurial as version control. I would like to keep the version control inside my git repository to be able to update the library in a easy way.
The current directory structure is as following:
root (git repo here)
directory1
...
directoryN
Is it safe to add the library in the root
folder and have the following configuration?
root (git repo here)
library_folder (mercurial repo here)
directory1
...
directoryN
If yes, are the changes made by updating library_folder
using mercurial visible to Git and are they safe to be committed to Git repo?
The workflow should be something like this:
library
library
updates Using your proposed flow, the entire '.hg' containing the full Mercurial history would also be committed. That seems like a waste, a lot of overhead and trouble waiting to happen.
A safer alternative would be using hg-git to convert your Mercurial repository, and then use git submodules or git subtree (not sure which is best) to store a reference to the correct changeset. That way, you only need to store a reference in your main repository, rather than all library contents and history.
One alternative would be to go for 'one big repository', but then you'd have to commit all of the 'library' files except the .hg directory. That can be easy to work with (less complexity). The downside is that you lose the history (you could look into tools to import the code with history and all).
You can move in opposite to the suggested by Mathiasdm direction: work with Mercurial repository directly from Git.
Mercurial bridge in Git will allow you to have and use Mercurial repositories (read Alex's comments) the same way, as you use Git repositories (and I'll suggest Git's subtree, not submodules)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.