One way to remove unwanted commit is using "hg strip REV" command.
hg strip rev removes the rev revision and all its descendants from a repository.
Let me show you an example in using hg strip.
1. View the current repository tree
2. Add a new file a.c
$ echo "Create new file a.c" > a.c
$ hgad a.c
$ hgci "Add new file a.c"
3. Work on this file, modify, commit, and tag it as a stable version for release
$ echo "Alan fixed a serious driver bug." >> a.c
$ hgci "Driver bug fix"
$ echo "Curtis makes AAC decode 10 times faster." >> a.c
$ hgci "Enhance performance"
$ hgta "Full tested" RELEASE_1.0
$ cat a.c
Create new file a.c
Alan fixed a serious driver bug.
Curtis makes AAC decode 10 times faster.
4. Base on RELEASE_1.0, continue add bug fix in hurry:
$ echo "Customer push, add quick fix." >> a.c
$ hgci "Not fully tested"
$ echo "Need to meet deadline, ci all fixes." >> a.c
$ hgci "Will be release 2.0 tomorrow"
$ cat a.c
Create new file a.c
Alan fixed a serious driver bug.
Curtis makes AAC decode 10 times faster.
Customer push, add quick fix.
Need to meet deadline, ci all fixes.
5. Use hg strip command to remove unwanted commit
At 11:00pm, suddenly find the last 2 commits (rev10, rev11) introduce a major bug, need to get rid of them and go back to rev9.
6. See the repository tree after hg strip
You can see rev10 and rev11 are removed from repository. The tip points to rev9.
7. Double check the file content is correct
$ cat a.c
Create new file a.c
Alan fixed a serious driver bug.
Curtis makes AAC decode 10 times faster.
Actually, Curtis and Alan already make the software good enough, can release RELEASE_1.0 to customer tomorrow! :)
Merry Xmas 2010!!!
沒有留言:
發佈留言