Seems like it would be better if you did commit followed by merge. I'm a little surprised update'ing is even allowed when your working copy has changes. Is allowing updates in such cases to avoid having commits that have two parents, which result from a merge?
Description. Update the repository's working directory to the specified changeset. If no changeset is specified, update to the tip of the current named branch and move the active bookmark (see hg help bookmarks). Update sets the working directory's parent revision to the specified changeset (see hg help parents).
hg revert changes the file content only and leaves the working copy parent revision alone. You typically use hg revert when you decide that you don't want to keep the uncommited changes you've made to a file in your working copy.
Reverting Local Changes If you use the TortoiseHg client to work with Mercurial from TestComplete, you can cancel all local changes not committed to the repository yet: Select File > Source Control > Revert from the TestComplete main menu.
Use the hg heads command to list the heads of the current repository. The tip is the changeset added to the repository most recently. If you have just made a commit, that commit will be the tip. Alternately, if you have just pulled from another repository, the tip of that repository becomes the new tip.
I believe hg update
will try to merge your uncommitted changes:
The following rules apply when the working directory contains uncommitted changes:
- If neither
-c/--check
nor-C/--clean
is specified, and:
if the requested changeset is an ancestor or descendant of the working directory's parent, the uncommitted changes are merged into the requested changeset and the merged result is left uncommitted.
If the requested changeset is not an ancestor or descendant (that is, it is on another branch), the update is aborted and the uncommitted changes are preserved.- With the
-c/--check
option, the update is aborted and the uncommitted changes are preserved.- With the
-C/--clean
option, uncommitted changes are discarded and the working directory is updated to the requested changeset.
That will avoid an unnecessary commit (registered in the .hg
repo) for an operation (hg update) which only is about updating your working directory.
Mercurial encourages recording all the history of a project. If you've done some work in your working directory, why not to commit these changes providing a meaningful description of your results as a commit message and then merge your results into the main branch? It will be more clear for other people to see in two separate changesets what you have made as your normal work and what you have made just for resolving merge conflicts.
Usually an extra merge changeset is OK, but sometimes you just want to rebase your current changes on top of the main branch before committing them. You might take a look at the rebase extension. The new hg rebase
command allows you to rebase already committed changeses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With