Switch between Mercurial working directories
The Mercurial integration with CLion provides the possibility to switch update the repository's working directory to the specified changeset or a specific line of development. Changesets can be identified by their hashes or by previously assigned tag identifiers.
You can update a named branch or a bookmark to another named branch, another bookmark, or a specific changeset identified by a tag or a revision number.
- Updating a named branch or a bookmark to another named branch or bookmark means updating to its head.
Updating to named branches and bookmarks can be invoked through the menu item Switch Working Directory dialog of from the Branches list.
, which opens the Mercurial-specific - Updating a named branch or a bookmark to a changeset means updating the branch head to the specified changeset. A changeset can be identified either by a revision number or a tag, see https://www.mercurial-scm.org/wiki/Tag.
Updating a named branch or a bookmark to a specific changeset can be invoked only through .
By default, Mercurial requires that before update the current working directory should be clean, that is, it should not contain any uncommitted changes. Otherwise the update operation fails and CLion shows the corresponding error message. The message also recommends that you clean the current working directory by running the hg update <target branch, bookmark, or changeset> -C
to discard the uncommitted changes.
If your current working copy is not clean, you can either commit the changes or shelve them as described in Shelve and unshelve changes. CLion provides the possibility to discard any uncommitted changes when the update operation is already invoked. This option is available only in the Mercurial-specific Switch Working Directory dialog.
Opening the Branches list
To open the Branches list, do one of the following:
On the Status bar, click the name of the current named branch in the dedicated hg area.
From the main menu, choose
.From the context menu of the Editor or Mercurial tool window, choose .
Switching to another named branch or bookmark
Updating a named branch or a bookmark to another named branch or bookmark means updating to its head.
- Make sure, your current working directory is clean, that is, it does not contain any uncommitted changes. Commit or shelve the changes, if any.
If you invoke update through the Switch Working Directory dialog, you can also prevent conflicts by having any uncommitted changes discarded.
- Invoke update by doing one of the following:
In the Branches list, click the name of the branch or bookmark to update to, then choose Update to from the list:
Choose Editor.
on the main menu or from the context menu of theIn the Switch Working Directory dialog that opens:
Choose the target repository from the Repository list which shows all the Mercurial repositories available under the current project root.
Choose the Branch or Bookmark option and choose the named branch or bookmark to update the current working directory to.
To prevent failures during update if the current working directory is not clean, select the Overwrite locally modified files (no backup) checkbox. The uncommitted changes will be discarded.
Switching to another changeset
- Make sure, your current working directory is clean, that is, it does not contain any uncommitted changes. Commit or shelve the changes, if any.
If you invoke update through the Switch Working Directory dialog, you can also prevent conflicts by having any uncommitted changes discarded.
- Invoke update by doing one of the following:
In the Branches list, click the name of the branch or bookmark to update to, then choose Update to from the list:
Choose Editor.
on the main menu or from the context menu of theIn the Switch Working Directory dialog that opens:
Choose the target repository from the Repository list which shows all the Mercurial repositories available under the current project root.
Choose the Branch or Bookmark option and choose the named branch or bookmark to update the current working directory to.
To prevent failures during update if the current working directory is not clean, select the Overwrite locally modified files (no backup) checkbox. The uncommitted changes will be discarded.
- Resolve conflicts. As soon as a conflict takes place, the Conflicts dialog opens with a list of conflicting files. Use the controls of the dialog to resolve the problems:
To have the version of the current working directory preserved, click Accept Yours.
To have the version of the branch you are merging with preserved, click Accept Theirs.
To resolve the conflicts manually, click Merge and use the Conflict Resolution Tool, as described in Resolve conflicts.
If no conflicts arise during update, the operation passes silently and the update log is shown in the Mercurial tool window.