MQ: strip - auto-search for branch head

Guido Ostkamp hg at ostkamp.fastmail.fm
Sun Aug 2 16:16:09 CDT 2009


Hello,

I noticed that using the 'bookmark' feature, Mercurial now emulates Git 
style branches to some degree.

However, to remove an unwanted branch from repository, using the 'hg 
strip' command is required.

I could not find a syntax that allows to easily strip a branch without 
knowing the exact revision ids. I'm thinking of something like this 
(example requires "track.current = True" setting in [bookmarks] within 
~/.hgrc):

$ hg init
$ echo "line 1" > file1
$ hg add file1
$ hg commit -m "initial checkin"
$ hg book master
$ hg book crazyidea
$ hg up -C crazyidea
$ echo "line 1" > file2
$ hg add file2
$ hg commit -m "branch checkin 1"
$ echo "line 2" >> file2
$ hg commit -m "branch checkin 2"
$ hg up -C master
$ echo "line 2" >> file1
$ hg commit -m "master checkin"
$ hg strip --branch crazyidea

This would act like "hg strip 1" in this case, because it looks like

$ hg glog
@  changeset:   3:2339be2082bf
|  tag:         master
|  tag:         tip
|  parent:      0:15da6b1a21f9
|  user:        testuser at bianca.dialin.t-online.de
|  date:        Sun Aug 02 23:10:21 2009 +0200
|  summary:     master checkin
|
| o  changeset:   2:f7d8e80b1403
| |  tag:         crazyidea
| |  user:        testuser at bianca.dialin.t-online.de
| |  date:        Sun Aug 02 23:10:21 2009 +0200
| |  summary:     branch checkin 2
| |
| o  changeset:   1:5cf25df2bd42
|/   user:        testuser at bianca.dialin.t-online.de
|    date:        Sun Aug 02 23:10:21 2009 +0200
|    summary:     branch checkin 1
|
o  changeset:   0:15da6b1a21f9
    user:        testuser at bianca.dialin.t-online.de
    date:        Sun Aug 02 23:10:21 2009 +0200
    summary:     initial checkin


It appears Brendan Cully already thought about this in 
<http://markmail.org/thread/5j7gnjgjde7fkt5o#query:+page:1+mid:5j7gnjgjde7fkt5o+state:results> 
(Sep 22, 2006), but it never made it into the extension and now the patch 
can no longer be applied due to earlier heavy code changes since the patch 
had been posted.

Any ideas how to get back the functionality?

We really need something as easy as "git branch -D crazybranch".

Regards

Guido


More information about the Mercurial mailing list