Bug: hg qnew records outstanding changes desite of not specifying -f

Andrey Vlasovskikh andrey.vlasovskikh at gmail.com
Thu Apr 1 15:32:22 CDT 2010


Hello,

I've found a very dangerous bug in Mercurial 1.5 that could lead to 
information loss. The help page for `hg qnew` says that:

> It will refuse to run if there are any outstanding changes unless
> -f/--force is specified, in which case the patch will be initialized
> with them.

However, when I use `hg qnew` *without* `-f`, all outstanding changes 
are put into the new patch.

Suppose I've erroneously typed `hg qnew p1.diff` and I want to undo this 
action by running `hg qdel p1.diff`. By running `qdel` I would loose all 
the outstanding changes I've made.

$ hg init test
$ cd test
$ echo test > test.txt
$ hg addremove
adding test.txt
$ hg ci -mm
$ echo test 2 >> test.txt
$ hg qnew p1.diff
$ hg qdel p1.diff

At this point, I've lost my "test 2" line.

-- 
Andrey Vlasovskikh

Web: http://claimid.com/vlasovskikh
IM: xmpp:andrey.vlasovskikh at gmail.com



More information about the Mercurial mailing list