Amy T
Amy T

Reputation: 618

Hg: How to Restore Changes That Were Backed Out?

I made and committed changes to my branch.

Someone else mistakenly merged and committed those changes to the default branch.

To fix their mistake, they used hg backout on default.

Then people committed a bunch of other changes to default.

I didn't realise the backout had happened, and wanted the latest changes. So I merged and committed default into my branch.

Now, the current state of my branch doesn't contain my changes.

What's the right way to get my earlier changes back and preserve the unrelated changes from default that I want to keep?

So far, I've tried merging my earlier changing into my working copy, but it doesn't like merging with an ancestor, and I've tried exporting the changes as a patch and importing them again, but get errors on the import.

It's funny, I'm liking switching to Mercurial from Subversion, but every time I think I might be getting the hang of it, some new bump like this crops up :-P

Upvotes: 5

Views: 459

Answers (2)

Chris Morgan
Chris Morgan

Reputation: 90712

Backout the backout. It's just an ordinary commit changing what was changed back, so it should work fine, changing what was changed back back.

Upvotes: 6

OneOfOne
OneOfOne

Reputation: 99195

Maybe get the rev number then clone it :

hg log --style compact

hg clone -r REV your-current-repo new-repo

Upvotes: 0

Related Questions