(See RepositoryConversion for existing conversion tools)
This describes the basic steps needed to do history conversion from arbitrary formats, as implemented in Mercurial's convert-repo script:
- Group changes into changesets
- This step is difficult for systems that don't have atomic commits. See cvsps for an example of how this can be done with CVS.
- Associate a unique identifier with each changeset
- Generate the revision graph by finding the parent changesets of each changeset
- Generate a topologically sorted list of changesets such that parents precede their children
- For each changeset:
- Extract or generate a changeset description, user name, and date
- Extract a copy of each file changed in the changeset
- Use the Mercurial rawcommit interface to explicitly commit the changeset
- Save a correspondence map between source changeset IDs and Mercurial changeset IDs so that the process can be
- interrupted and resumed
- Convert tags
- Generate a list of tags and their corresponding source changeset IDs
- Use the correspondence map to convert tags to Mercurial IDs
- Write a .hgtags file
- Commit .hgtags file
Some conversions can be very difficult. It would be worth checking out ProblematicConversions to see how one such conversion was handled.