Rewrite commit hashes in commit message
We have a lot of changeset hashes in a commit message to link from one commit to another commit. If we convert from hg to git the hashes are invalid. Is it possible that the converter rewrites the old hg hash in an old commit message to the new git hash of the new commit message?
Would be nice if it could generate a mapping file afterwards. So it can be used in other tools, too.
Fast export uses git-fast-import in the input only mode, so the mapping of hg hashes to git hashes isn't available until the conversion has finished (check the git-fast-import manpage). Theoretically you could change fast-export to use the get-mark fast import command and provide an interface to it in the commit filter plugin API.
If you are not planning on doing incremental imports, i.e. you want to convert your whole repo in one go, you could probably cobble something together by first doing a conversion using --hg-hash and then post-process the resulting git repo using git filter-branch.
An alternative would be to use a commit filter plugin to add the hg-hash to the commit message thus avoiding having to look up git annotations while running git filter branch.
An alternative would be to use a commit filter plugin to add the hg-hash to the commit message thus avoiding having to look up git annotations while running git filter branch.
I have hacked such a plugin for myself (my use case was to convert an hg repo to git only once and I feel that git notes are too ephemeral for my taste). From your comment, can I assume that a pull request would be welcome?
From your comment, can I assume that a pull request would be welcome?
That is a correct assumption.
No activity in over 6 months, closing.