Things That Can Be Done With Mercurial

Things that can be done with Mercurial.

Have changes in working directory. Want to update to latest code but still have changes in working directory, just updated.

Q: Do you think there will be major conflicts?

A: If No, then just do an update and when prompted, choose merge. This is very similar to the CVS/SVN workflow.

A: If yes, then the following will provide safer merging of changes with a backout option, but won’t create a merge changeset.

  1. Commit changes. Message not particularly relevant, as it will be gone when done.
  2. Update to tip of other changes.
  3. Rebase above changeset onto tip, resolving any conflicts. Don’t forget to ‘keep original changesets’ if you want to have a fallback option.
  4. If rebase went well, and you kept original changesets, strip the original changesets
  5. If rebase went poorly, strip the rebased changesets and try again.
  6. To put changes back into working directory, use hg strip -k {revision/changeset number containing changes}. This will put your changes back into the working directory. Note that the log in TortoiseHG is also a command line. If you do the strip-k from THG, don’t be surprised if an error window appears. It’s an issue with THG not expecting a revision to ‘disappear’ like that, and unfortunately can’t be easily solved. It’s not doing any harm, and is safe to dismiss, but is annoying. If I ever get ambitious enough, I’ll get the source for THG and add the -k option on the strip dialog…

It's only fair to share...
Share on Facebook
Tweet about this on Twitter
Share on LinkedIn

Leave a Reply