I have a case to migrate only one folder from Mercurial(Hg) to Gitlab (not the entire repository) with its history.
I came across hg-fast-export but I am not sure if we can export only a few files to GitLab. If yes suggest to me how to do this.
Thanks in advance.
A good way to do this would be to use hg convert
with the filemap
option to first create a second temporary Mercurial repository which contains only the folder your are interested in, and then import just that to Gitlab.
Convert
can also filter or rename files during conversion, when you supply it a mapping via the--filemap
option.The filemap is a file that specifies which files are to be included, renamed, or omitted. By default all files are included (empty filemap means include everything).
Each line can contain one of the following directives:
include path/to/file
exclude path/to/file
rename from/file to/file
Note that when you use convert it produces an entirely new repository that is not "related" to the original. So changeset IDs will be different. Seems like this won't cause any harm for what you are doing.