[PATCH 1 of 2] patch: support diff data loss detection and upgrade

Thomas Arendsen Hein thomas at intevation.de
Thu Dec 31 06:20:27 CST 2009

* Patrick Mézard <pmezard at gmail.com> [20091231 12:43]:
> Le 31/12/09 11:31, Thomas Arendsen Hein a écrit :
> > Imagine "hg export -o %n.patch 0:100" or patchbombing multiple
> > changesets and want to abort (instead of warn) if this would not be
> > possible with standard patches before writing 90 of 101 files or,
> > even more important, before sending out 7 of 10 mails to a public
> > mailing list.
> > 
> > Ideally in this case there would be a quick check if
> > - copies have been used
> > - executable status has changed
> > - empty files have been created or deleted
> Thank you, I missed empty file removals.
> > - binary files are affected
> > 
> > and only after that real patches will be generated.
> Sure, but this quickcheck must run over all individual patches being generated, with the same arguments passed to patch.diff(). If you look at patch.diff() you will see this quickcheck *is* patch.diff() with dodiff=False, disabling binary or unidiff generation. So a first approximation of this quickcheck is to call patch.diff() and discard the result. Or we can add some --dry-run option to avoid generating the output. I would consider duplicating the checking logic elsewhere only if these solutions are not good enough.

This sounds good enough to start.

Though it might be nice to store the results of the initial check so
it only has to be done once, but if mpm agrees, this can be done in
a later step.


thomas at intevation.de - http://intevation.de/~thomas/ - OpenPGP key: 0x5816791A
Intevation GmbH, Neuer Graben 17, 49074 Osnabrueck - AG Osnabrueck, HR B 18998
Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner

More information about the Mercurial-devel mailing list