FaqHgRenameProject

How can I rename or move a project without losing Mercurial metadata?

The Problem:

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.

The Solution:

To rename or move a project that is also the Hg repository root:

  1. Commit all changes to the repository.
  2. Outside of the IDE copy the .hg folder (including any other .hg files (e.g., .hgignore) to a backup location.
  3. Rename the project in the IDE. (Any .hg metadata are deleted.)
  4. Close down the IDE.
  5. Copy all .hg metadata from the backup location (see step 2 above) into the project.
  6. 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.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo