How can I rename or move a project without losing Mercurial metadata?
If the root of the Mercurial repository is also the root of the project, using the IDE's Rename or Move operations will not copy over Mercurial metadata (i.e., the .hg folder).
Note that the risk of losing the .hg folder occurs only in the event that the root of the repository is also the root of the project, which is not a common case.
To rename or move a project that is also the Hg repository root:
- Commit all changes to the repository.
- Outside of the IDE copy the .hg folder (including any other .hg files (e.g., .hgignore) to a backup location.
- Rename the project in the IDE. (Any .hg metadata are deleted.)
- Close down the IDE.
- Copy all .hg metadata from the backup location (see step 2 above) into the project.
- Restart the IDE.
Note that in other use-cases where the project is not the root of the repository, renaming the project works as advertised:
Use-case 1: Rename or move only project, not project folder
Works ok. User can commit the changed project to the Mercurial repository.
Use-case 2: Rename or move both project and project folder
Works ok. Hg metadata is lost, but user can commit changed project to the Mercurial repository.