Jason
Jason

Reputation: 52533

Mercurial: How to pull out an old changeset as a separate codebase, do work, merge, and continue working on current?

I have a large codebase that I have been working on for a while. It is not ready to push live, even experimentally. However, my client is requiring a minor change that I cannot fix without pushing my whole new update (which is not ready). I would like to do the following:

  1. Take a stable changeset (I know which one) and create a codebase that I can then work from in Visual Studio.
  2. Make the (very minor) update
  3. Commit my change
  4. Upload my change to the server
  5. Merge/push my changes
  6. Be able to go on working on my current project with that minor change included

I don't want to screw anything up though. Can anyone offer some advice on how to do this?

Thanks

Upvotes: 1

Views: 791

Answers (1)

John Zwinck
John Zwinck

Reputation: 249404

Sure.

  1. hg clone then hg update <rev> to the stable changeset
  2. Edit the code as needed
  3. hg commit
  4. Upload this version (stable + patch) to the server
  5. hg push to the server (your new patch)
  6. At some point, do hg pull in your main development clone when you don't have any uncommitted changes, then do hg rebase to make Mercurial adjust your main development changesets to come after the patch we made above. The history will then be as if the "hotfix" had been done before you started working on your new development.

Upvotes: 1

Related Questions