Bug 3652 - hg export -o foo appends
Summary: hg export -o foo appends
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: earlier
Hardware: PC Linux
: normal bug
Assignee: Augie Fackler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-05 15:44 UTC by Jordi Gutiérrez Hermoso
Modified: 2017-11-01 18:05 UTC (History)
5 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jordi Gutiérrez Hermoso 2012-10-05 15:44 UTC
This has been a source of confusion for some time, and is probably unintended behaviour. When using "hg export -r tip -o foo" more than once, you get multiple copies of the patch in the file "foo". There is no documentation anywhere that this is the intended behaviour and I have seen people confused about getting more than one patch in the same file, so I'm inclined to think this is a bug.
Comment 1 Augie Fackler 2012-10-05 20:02 UTC
Patch incoming.
Comment 2 Kevin Bullock 2012-10-08 11:33 UTC
For the record, mpm says:

> We want to overwrite old files. But we also want to gather patches into
> files from the current command. Which suggests we want to keep track of
> which files we've visited and adjust the mode accordingly:
>
> if f in seen:
>    mode = 'a'
> else:
>    mode = 'o'
>    seen.add(f)
Comment 3 Augie Fackler 2012-10-08 11:33 UTC
I've mailed a patch for this.
Comment 4 HG Bot 2013-02-09 17:45 UTC
Fixed by http://selenic.com/repo/hg/rev/1a2f4c633410
Augie Fackler <raf@durin42.com>
export: clobber files with -o (bc) (issue3652)

This violated user expectation. Updated the code to clobber files, but
preserve the behavior of appending multiple patches requested in a
single export. Includes tests.

(please test the fix)