[PATCH] export: make -o foo overwrite, not append

Jordi Gutiérrez Hermoso jordigh at octave.org
Thu Oct 4 13:54:23 CDT 2012


On 4 October 2012 14:08, Kevin Bullock <kbullock+mercurial at ringworld.org> wrote:
> On Oct 4, 2012, at 12:41 PM, Jordi Gutiérrez Hermoso wrote:
>
>> # HG changeset patch
>> # User Jordi Gutiérrez Hermoso <jordigh at octave.org>
>> # Date 1349372425 14400
>> # Node ID 80eea80279e6804128b828da97ff57c1da89a07c
>> # Parent  fa714f3ed2989aff64c267c9935251d9fc4f31ee
>> export: make -o foo overwrite, not append
>>
>> Currently, "hg export -r foo -o bar" appends the results to bar, which
>> is mentioned nowhere in the documentation. This confuses users who
>> expect to get only one change in there, not several. This cset just
>> makes the -o option overwrite, not append.
>
> I agree that that's surprising behavior, especially when exporting
> multiple changes with a parameterized file name spec. But it appears
> to go back to this:
>
> changeset:   7319:eae1767cc6a8
> user:        Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
> date:        Thu Nov 06 11:17:38 2008 +0100
> files:       mercurial/cmdutil.py mercurial/patch.py tests/test-export tests/test-export.out
> description:
> export: fixed silent output file overwriting
>
> hg export -o outfile 1 2 3 4 had the same effect as hg -o outfile 4
>
> This was caused by opening with 'w' instead of 'a'. This only occurs when
> the filename pattern resulted in ambiguous patch filenames.

So, should the current behaviour stay? Then it should be documented.
Should I do that?

- Jordi G. H.


More information about the Mercurial-devel mailing list