Friday, July 29, 2011

Mercurial Strip


Yesterday evening in was in a bit of a fix at work, I was working on a new feature-name mercurial branch and and committed a few things into the branch and posted the changes onto a review system we have at work. after the team reviewed my changes it was time to push them over and merge it with the main "DEFAULT" branch.

So I started and did as follows:

hg st
Should show no modified files.
Make sure your working copy is based on the branch:
hg branch
It should report the name of the feature branch. 
hg update feature-name
Close out the branch if it's a Feature Branch
hg commit --close-branch -m "closed branch feature-name"
Update working copy to be based off of the default branch instead of the branch:
hg update default
Merge from the branch to default (assuming feature-name is the name of the branch you are merging to default):
hg merge feature-name
When everything looks good, commit the merge 
hg commit -m "merged feature-name branch to default"
and at last push the merge onto default.
I did the above step by step but then at last the "hg push" aborted with an error, So now what to do.
I looked back and realize that I didnt push the changes into the feature barnch (though committed them), but now have so many change sets and I am on Default branch now.

I update back to my feture branch and want to be at the same change set where I started so here comes "hg strip" to my rescue, though there can other solution too, I used hg strip to strip off all the change set and start over merging into default again.

Okay so now What is that hg strip command do...here is brief explanation below:

hg strip rev removes the rev revision and all its descendants from a repository. To remove an unwanted branch, you would specify the first revision specific to that branch. By default, hg strip will place a backup in the .hg/strip-backup/ directory. If strip turned out to be a bad idea, you can restore with hg unbundle .hg/strip-backup/filename.
If others revision in the repository have higher number than the stripped one, those one are renumbered in order to keep a sequential numbering scheme. The hash remains the same.

Tuesday, July 26, 2011

What you should expect from this Blog?

I have created this blog to post, discuss and share my learning and know hows of all things technical which I come across on day to day basis and HAD PAIN understanding or explaining . This is like a journal of my new learning. Though this blog will primarily be technical in nature but not just design verification(my profession) , it will cover a broader spectrum of whatever I learn, be it be a how a new gadget works, how and why a particular running shoe performs better etc etc.