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

Kurt Granroth kurt.mercurial at granroth.com
Thu Apr 1 21:11:23 CDT 2010


Interesting... I would see that more as an undocumented (or incorrectly 
documented) feature rather than a bug.  That is, that sequence makes 
perfect sense to me and acts exactly like I would expect it to.

Yet you are right that the docs say otherwise.  The examples on the wiki 
show otherwise, as well.  I imagine this behavior must have changed 
recently and the docs were just not updated.

So..

hg qinit
hg qnew patch
<edit something>
hg qrefresh

Can now be done as:

<edit something>
hg qnew patch

No need for qinit and no need for qrefresh.  That's handy to know.

On 4/1/10 1:32 PM, Andrey Vlasovskikh wrote:
> 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.
>



More information about the Mercurial mailing list